From 381fb617d398cb9588d5c95a0ec94b1351c4eb1e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Sun, 15 Jun 2008 18:01:07 +0500 Subject: Bug #35934 mysql_upgrade calls mysqlcheck with insufficient parameters. Parameters added to the mysqlcheck call to fix table/database names. client/mysql_upgrade.c: Bug #35934 mysql_upgrade calls mysqlcheck with insufficient parameters. --fix-db-names and --fix-table-names added to the mysqlcheck call --- client/mysql_upgrade.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 6c5ca039a41..088115ec3ac 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -652,6 +652,8 @@ static int run_mysqlcheck_upgrade(void) "--check-upgrade", "--all-databases", "--auto-repair", + "--fix-db-names", + "--fix-table-names", NULL); } -- cgit v1.2.1 From 317d545b14b821b336187090008b52c9eea6733f Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 23 Oct 2008 19:04:52 +0200 Subject: Raise version number for 5.0.66sp1 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index a1dc9d36d82..8c177892f18 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.66a) +AM_INIT_AUTOMAKE(mysql, 5.0.66sp1) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 -- cgit v1.2.1 From 839b60a8da25207cae9b9f75d824d4566eb13899 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 23 Oct 2008 19:36:48 +0200 Subject: Merge fix for bug#38296 into 5.0.66sp1 --- mysys/my_alloc.c | 2 +- sql/field.h | 3 +- sql/item.h | 4 +- sql/sp_head.cc | 2 +- sql/sql_lex.h | 4 +- sql/sql_list.h | 4 +- sql/sql_string.h | 2 +- sql/sql_yacc.yy | 1775 +++++++++++++++++++++++++++++++++++++++++++---------- sql/thr_malloc.cc | 31 +- 9 files changed, 1483 insertions(+), 344 deletions(-) diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 5983a29a3e1..99b5aec7eea 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -202,7 +202,7 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) { if (mem_root->error_handler) (*mem_root->error_handler)(); - return((gptr) 0); /* purecov: inspected */ + DBUG_RETURN((gptr) 0); /* purecov: inspected */ } mem_root->block_num++; next->next= *prev; diff --git a/sql/field.h b/sql/field.h index 8d771a151a7..241ad61f339 100644 --- a/sql/field.h +++ b/sql/field.h @@ -48,7 +48,8 @@ class Field Field(const Item &); /* Prevent use of these */ void operator=(Field &); public: - static void *operator new(size_t size) {return (void*) sql_alloc((uint) size); } + static void *operator new(size_t size) throw () + { return (void*) sql_alloc((uint) size); } static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); } char *ptr; // Position to field in record diff --git a/sql/item.h b/sql/item.h index a948c5a45f7..126730bb892 100644 --- a/sql/item.h +++ b/sql/item.h @@ -439,9 +439,9 @@ class Item { Item(const Item &); /* Prevent use of these */ void operator=(Item &); public: - static void *operator new(size_t size) + static void *operator new(size_t size) throw () { return (void*) sql_alloc((uint) size); } - static void *operator new(size_t size, MEM_ROOT *mem_root) + static void *operator new(size_t size, MEM_ROOT *mem_root) throw () { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) {} diff --git a/sql/sp_head.cc b/sql/sp_head.cc index aea81e301ef..7cc551a76c0 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -446,7 +446,7 @@ sp_head::operator new(size_t size) throw() init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC); sp= (sp_head *) alloc_root(&own_root, size); if (sp == NULL) - return NULL; + DBUG_RETURN(NULL); sp->main_mem_root= own_root; DBUG_PRINT("info", ("mem_root 0x%lx", (ulong) &sp->mem_root)); DBUG_RETURN(sp); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index cde4c3a97b3..79cc0b6b3f2 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -331,11 +331,11 @@ public: bool no_table_names_allowed; /* used for global order by */ bool no_error; /* suppress error message (convert it to warnings) */ - static void *operator new(size_t size) + static void *operator new(size_t size) throw () { return (void*) sql_alloc((uint) size); } - static void *operator new(size_t size, MEM_ROOT *mem_root) + static void *operator new(size_t size, MEM_ROOT *mem_root) throw () { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) {} diff --git a/sql/sql_list.h b/sql/sql_list.h index 7913acfd086..1ad2051f065 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -27,7 +27,7 @@ public: { return (void*) sql_alloc((uint) size); } - static void *operator new[](size_t size) + static void *operator new[](size_t size) throw () { return (void*) sql_alloc((uint) size); } @@ -466,7 +466,7 @@ public: struct ilink { struct ilink **prev,*next; - static void *operator new(size_t size) + static void *operator new(size_t size) throw () { return (void*)my_malloc((uint)size, MYF(MY_WME | MY_FAE)); } diff --git a/sql/sql_string.h b/sql/sql_string.h index c1d27cb1791..4432451464e 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -78,7 +78,7 @@ public: Alloced_length=str.Alloced_length; alloced=0; str_charset=str.str_charset; } - static void *operator new(size_t size, MEM_ROOT *mem_root) + static void *operator new(size_t size, MEM_ROOT *mem_root) throw () { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr_arg,size_t size) { TRASH(ptr_arg, size); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 090585392a0..c89676d0bde 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1539,6 +1539,8 @@ create: { LEX *lex=Lex; Key *key= new Key($2, $4.str, $5, 0, lex->col_list); + if (key == NULL) + MYSQL_YYABORT; lex->alter_info.key_list.push_back(key); lex->col_list.empty(); @@ -1598,6 +1600,8 @@ sp_name: MYSQL_YYABORT; } $$= new sp_name($1, $3, true); + if ($$ == NULL) + MYSQL_YYABORT; $$->init_qname(YYTHD); } | ident @@ -1613,8 +1617,9 @@ sp_name: if (lex->copy_db_to(&db.str, &db.length)) MYSQL_YYABORT; $$= new sp_name(db, $1, false); - if ($$) - $$->init_qname(YYTHD); + if ($$ == NULL) + MYSQL_YYABORT; + $$->init_qname(YYTHD); } ; @@ -1865,6 +1870,8 @@ sp_decl: if (!dflt_value_item) { dflt_value_item= new Item_null(); + if (dflt_value_item == NULL) + MYSQL_YYABORT; /* QQ Set to the var_type with null_value? */ } @@ -1890,10 +1897,17 @@ sp_decl: /* The last instruction is responsible for freeing LEX. */ - lex->sphead->add_instr( - new sp_instr_set(lex->sphead->instructions(), pctx, var_idx, - dflt_value_item, var_type, lex, - (i == num_vars - 1))); + sp_instr_set *is= new sp_instr_set(lex->sphead->instructions(), + pctx, + var_idx, + dflt_value_item, + var_type, + lex, + (i == num_vars - 1)); + if (is == NULL) + MYSQL_YYABORT; + + lex->sphead->add_instr(is); } pctx->declare_var_boundary(0); @@ -1927,6 +1941,8 @@ sp_decl: sp_instr_hpush_jump *i= new sp_instr_hpush_jump(sp->instructions(), ctx, $2, ctx->current_var_count()); + if (i == NULL) + MYSQL_YYABORT; sp->add_instr(i); sp->push_backpatch(i, ctx->push_label((char *)"", 0)); @@ -1979,7 +1995,7 @@ sp_decl: } i= new sp_instr_cpush(sp->instructions(), ctx, $5, ctx->current_cursor_count()); - if ( i==NULL ) + if (i == NULL) MYSQL_YYABORT; sp->add_instr(i); ctx->push_cursor(&$2); @@ -2060,6 +2076,8 @@ sp_cond: ulong_num { /* mysql errno */ $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + YYABORT; $$->type= sp_cond_type_t::number; $$->mysqlerr= $1; } @@ -2071,6 +2089,8 @@ sp_cond: MYSQL_YYABORT; } $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + YYABORT; $$->type= sp_cond_type_t::state; memcpy($$->sqlstate, $3.str, 5); $$->sqlstate[5]= '\0'; @@ -2099,16 +2119,22 @@ sp_hcond: | SQLWARNING_SYM /* SQLSTATEs 01??? */ { $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + YYABORT; $$->type= sp_cond_type_t::warning; } | not FOUND_SYM /* SQLSTATEs 02??? */ { $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + YYABORT; $$->type= sp_cond_type_t::notfound; } | SQLEXCEPTION_SYM /* All other SQLSTATEs */ { $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); + if ($$ == NULL) + YYABORT; $$->type= sp_cond_type_t::exception; } ; @@ -3084,6 +3110,8 @@ key_def: { LEX *lex=Lex; Key *key= new Key($1, $2, $7 ? $7 : $3, 0, lex->col_list); + if (key == NULL) + MYSQL_YYABORT; lex->alter_info.key_list.push_back(key); lex->col_list.empty(); /* Alloced by sql_alloc */ @@ -3093,6 +3121,8 @@ key_def: LEX *lex=Lex; const char *key_name= $3 ? $3:$1; Key *key= new Key($2, key_name, $4, 0, lex->col_list); + if (key == NULL) + MYSQL_YYABORT; lex->alter_info.key_list.push_back(key); lex->col_list.empty(); /* Alloced by sql_alloc */ } @@ -3106,10 +3136,14 @@ key_def: lex->fk_delete_opt, lex->fk_update_opt, lex->fk_match_option); + if (key == NULL) + MYSQL_YYABORT; lex->alter_info.key_list.push_back(key); key= new Key(Key::MULTIPLE, key_name, HA_KEY_ALG_UNDEF, 1, lex->col_list); + if (key == NULL) + MYSQL_YYABORT; lex->alter_info.key_list.push_back(key); lex->col_list.empty(); /* Alloced by sql_alloc */ } @@ -3399,7 +3433,12 @@ attribute: ; now_or_signed_literal: - NOW_SYM optional_braces { $$= new Item_func_now_local(); } + NOW_SYM optional_braces + { + $$= new Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; + } | signed_literal { $$=$1; } ; @@ -3525,8 +3564,21 @@ opt_ref_list: | '(' ref_list ')' opt_on_delete {}; ref_list: - ref_list ',' ident { Lex->ref_list.push_back(new key_part_spec($3.str)); } - | ident { Lex->ref_list.push_back(new key_part_spec($1.str)); }; + ref_list ',' ident + { + key_part_spec *key= new key_part_spec($3.str); + if (key == NULL) + MYSQL_YYABORT; + Lex->ref_list.push_back(key); + } + | ident + { + key_part_spec *key= new key_part_spec($1.str); + if (key == NULL) + MYSQL_YYABORT; + Lex->ref_list.push_back(key); + } + ; opt_on_delete: @@ -3617,16 +3669,24 @@ key_list: | key_part order_dir { Lex->col_list.push_back($1); }; key_part: - ident { $$=new key_part_spec($1.str); } - | ident '(' NUM ')' - { - int key_part_len= atoi($3.str); - if (!key_part_len) + ident { - my_error(ER_KEY_PART_0, MYF(0), $1.str); + $$= new key_part_spec($1.str); + if ($$ == NULL) + MYSQL_YYABORT; } - $$=new key_part_spec($1.str,(uint) key_part_len); - }; + | ident '(' NUM ')' + { + int key_part_len= atoi($3.str); + if (!key_part_len) + { + my_error(ER_KEY_PART_0, MYF(0), $1.str); + } + $$=new key_part_spec($1.str,(uint) key_part_len); + if ($$ == NULL) + MYSQL_YYABORT; + } + ; opt_ident: /* empty */ { $$=(char*) 0; } /* Defaultlength */ @@ -3796,8 +3856,10 @@ alter_list_item: | DROP opt_column field_ident opt_restrict { LEX *lex=Lex; - lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::COLUMN, - $3.str)); + Alter_drop *ad= new Alter_drop(Alter_drop::COLUMN, $3.str); + if (ad == NULL) + MYSQL_YYABORT; + lex->alter_info.drop_list.push_back(ad); lex->alter_info.flags|= ALTER_DROP_COLUMN; } | DROP FOREIGN KEY_SYM opt_ident @@ -3807,15 +3869,19 @@ alter_list_item: | DROP PRIMARY_SYM KEY_SYM { LEX *lex=Lex; - lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, - primary_key_name)); + Alter_drop *ad= new Alter_drop(Alter_drop::KEY, primary_key_name); + if (ad == NULL) + MYSQL_YYABORT; + lex->alter_info.drop_list.push_back(ad); lex->alter_info.flags|= ALTER_DROP_INDEX; } | DROP key_or_index field_ident { LEX *lex=Lex; - lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, - $3.str)); + Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $3.str); + if (ad == NULL) + MYSQL_YYABORT; + lex->alter_info.drop_list.push_back(ad); lex->alter_info.flags|= ALTER_DROP_INDEX; } | DISABLE_SYM KEYS @@ -3833,14 +3899,19 @@ alter_list_item: | ALTER opt_column field_ident SET DEFAULT signed_literal { LEX *lex=Lex; - lex->alter_info.alter_list.push_back(new Alter_column($3.str,$6)); + Alter_column *ac= new Alter_column($3.str, $6); + if (ac == NULL) + MYSQL_YYABORT; + lex->alter_info.alter_list.push_back(ac); lex->alter_info.flags|= ALTER_CHANGE_COLUMN_DEFAULT; } | ALTER opt_column field_ident DROP DEFAULT { LEX *lex=Lex; - lex->alter_info.alter_list.push_back(new Alter_column($3.str, - (Item*) 0)); + Alter_column *ac= new Alter_column($3.str, (Item*) 0); + if (ac == NULL) + MYSQL_YYABORT; + lex->alter_info.alter_list.push_back(ac); lex->alter_info.flags|= ALTER_CHANGE_COLUMN_DEFAULT; } | RENAME opt_to table_ident @@ -4466,10 +4537,11 @@ select_item_list: | '*' { THD *thd= YYTHD; - if (add_item_to_list(thd, - new Item_field(&thd->lex->current_select-> - context, - NULL, NULL, "*"))) + Item *item= new Item_field(&thd->lex->current_select->context, + NULL, NULL, "*"); + if (item == NULL) + MYSQL_YYABORT; + if (add_item_to_list(thd, item)) MYSQL_YYABORT; (thd->lex->current_select->with_wild)++; }; @@ -4580,12 +4652,16 @@ expr: { /* X OR Y */ $$ = new (YYTHD->mem_root) Item_cond_or($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; } } | expr XOR expr %prec XOR { /* XOR is a proprietary extension */ $$ = new (YYTHD->mem_root) Item_cond_xor($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; } | expr and expr %prec AND_SYM { @@ -4626,62 +4702,124 @@ expr: { /* X AND Y */ $$ = new (YYTHD->mem_root) Item_cond_and($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; } } | NOT_SYM expr %prec NOT_SYM - { $$= negate_expression(YYTHD, $2); } + { + $$= negate_expression(YYTHD, $2); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri IS TRUE_SYM %prec IS - { $$= new (YYTHD->mem_root) Item_func_istrue($1); } + { + $$= new (YYTHD->mem_root) Item_func_istrue($1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri IS not TRUE_SYM %prec IS - { $$= new (YYTHD->mem_root) Item_func_isnottrue($1); } + { + $$= new (YYTHD->mem_root) Item_func_isnottrue($1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri IS FALSE_SYM %prec IS - { $$= new (YYTHD->mem_root) Item_func_isfalse($1); } + { + $$= new (YYTHD->mem_root) Item_func_isfalse($1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri IS not FALSE_SYM %prec IS - { $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); } + { + $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri IS UNKNOWN_SYM %prec IS - { $$= new Item_func_isnull($1); } + { + $$= new Item_func_isnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri IS not UNKNOWN_SYM %prec IS - { $$= new Item_func_isnotnull($1); } + { + $$= new Item_func_isnotnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri ; bool_pri: bool_pri IS NULL_SYM %prec IS - { $$= new Item_func_isnull($1); } + { + $$= new Item_func_isnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri IS not NULL_SYM %prec IS - { $$= new Item_func_isnotnull($1); } + { + $$= new Item_func_isnotnull($1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM - { $$= new Item_func_equal($1,$3); } + { + $$= new Item_func_equal($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri comp_op predicate %prec EQ - { $$= (*$2)(0)->create($1,$3); } + { + $$= (*$2)(0)->create($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bool_pri comp_op all_or_any '(' subselect ')' %prec EQ - { $$= all_any_subquery_creator($1, $2, $3, $5); } + { + $$= all_any_subquery_creator($1, $2, $3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } | predicate ; predicate: bit_expr IN_SYM '(' subselect ')' { $$= new (YYTHD->mem_root) Item_in_subselect($1, $4); + if ($$ == NULL) + MYSQL_YYABORT; } | bit_expr not IN_SYM '(' subselect ')' { THD *thd= YYTHD; Item *item= new (thd->mem_root) Item_in_subselect($1, $5); + if (item == NULL) + MYSQL_YYABORT; $$= negate_expression(thd, item); + if ($$ == NULL) + MYSQL_YYABORT; } | bit_expr IN_SYM '(' expr ')' { $$= handle_sql2003_note184_exception(YYTHD, $1, true, $4); + if ($$ == NULL) + MYSQL_YYABORT; } | bit_expr IN_SYM '(' expr ',' expr_list ')' { $6->push_front($4); $6->push_front($1); $$= new (YYTHD->mem_root) Item_func_in(*$6); + if ($$ == NULL) + MYSQL_YYABORT; } | bit_expr not IN_SYM '(' expr ')' { $$= handle_sql2003_note184_exception(YYTHD, $1, false, $5); + if ($$ == NULL) + MYSQL_YYABORT; } | bit_expr not IN_SYM '(' expr ',' expr_list ')' { @@ -4694,54 +4832,146 @@ predicate: $$= item; } | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate - { $$= new Item_func_between($1,$3,$5); } + { + $$= new Item_func_between($1,$3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate { Item_func_between *item= new Item_func_between($1,$4,$6); + if (item == NULL) + MYSQL_YYABORT; item->negate(); $$= item; } | bit_expr SOUNDS_SYM LIKE bit_expr - { $$= new Item_func_eq(new Item_func_soundex($1), - new Item_func_soundex($4)); } + { + Item *item1= new Item_func_soundex($1); + Item *item4= new Item_func_soundex($4); + if ((item1 == NULL) || (item4 == NULL)) + MYSQL_YYABORT; + $$= new Item_func_eq(item1, item4); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr LIKE simple_expr opt_escape - { $$= new Item_func_like($1,$3,$4,Lex->escape_used); } + { + $$= new Item_func_like($1,$3,$4,Lex->escape_used); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr not LIKE simple_expr opt_escape - { $$= new Item_func_not(new Item_func_like($1,$4,$5, Lex->escape_used)); } - | bit_expr REGEXP bit_expr { $$= new Item_func_regex($1,$3); } + { + Item *item= new Item_func_like($1,$4,$5, Lex->escape_used); + if (item == NULL) + MYSQL_YYABORT; + $$= new Item_func_not(item); + if ($$ == NULL) + MYSQL_YYABORT; + } + | bit_expr REGEXP bit_expr + { + $$= new Item_func_regex($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr not REGEXP bit_expr - { $$= negate_expression(YYTHD, new Item_func_regex($1,$4)); } + { + Item *item= new Item_func_regex($1,$4); + if (item == NULL) + MYSQL_YYABORT; + $$= negate_expression(YYTHD, item); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr ; bit_expr: bit_expr '|' bit_expr %prec '|' - { $$= new Item_func_bit_or($1,$3); } + { + $$= new Item_func_bit_or($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '&' bit_expr %prec '&' - { $$= new Item_func_bit_and($1,$3); } + { + $$= new Item_func_bit_and($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT - { $$= new Item_func_shift_left($1,$3); } + { + $$= new Item_func_shift_left($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT - { $$= new Item_func_shift_right($1,$3); } + { + $$= new Item_func_shift_right($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '+' bit_expr %prec '+' - { $$= new Item_func_plus($1,$3); } + { + $$= new Item_func_plus($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '-' bit_expr %prec '-' - { $$= new Item_func_minus($1,$3); } + { + $$= new Item_func_minus($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '+' interval_expr interval %prec '+' - { $$= new Item_date_add_interval($1,$3,$4,0); } + { + $$= new Item_date_add_interval($1,$3,$4,0); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '-' interval_expr interval %prec '-' - { $$= new Item_date_add_interval($1,$3,$4,1); } + { + $$= new Item_date_add_interval($1,$3,$4,1); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '*' bit_expr %prec '*' - { $$= new Item_func_mul($1,$3); } + { + $$= new Item_func_mul($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '/' bit_expr %prec '/' - { $$= new Item_func_div($1,$3); } + { + $$= new Item_func_div($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '%' bit_expr %prec '%' - { $$= new Item_func_mod($1,$3); } + { + $$= new Item_func_mod($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr DIV_SYM bit_expr %prec DIV_SYM - { $$= new Item_func_int_div($1,$3); } + { + $$= new Item_func_int_div($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr MOD_SYM bit_expr %prec MOD_SYM - { $$= new Item_func_mod($1,$3); } + { + $$= new Item_func_mod($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | bit_expr '^' bit_expr - { $$= new Item_func_bit_xor($1,$3); } + { + $$= new Item_func_bit_xor($1,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | simple_expr ; @@ -4771,67 +5001,118 @@ simple_expr: simple_ident | simple_expr COLLATE_SYM ident_or_text %prec NEG { - $$= new Item_func_set_collation($1, - new Item_string($3.str, - $3.length, - YYTHD->charset())); + Item *item= new Item_string($3.str, $3.length, YYTHD->charset()); + if (item == NULL) + MYSQL_YYABORT; + $$= new Item_func_set_collation($1, item); + if ($$ == NULL) + MYSQL_YYABORT; } | literal | param_marker | variable | sum_expr | simple_expr OR_OR_SYM simple_expr - { $$= new Item_func_concat($1, $3); } - | '+' simple_expr %prec NEG { $$= $2; } - | '-' simple_expr %prec NEG { $$= new Item_func_neg($2); } - | '~' simple_expr %prec NEG { $$= new Item_func_bit_neg($2); } - | not2 simple_expr %prec NEG { $$= negate_expression(YYTHD, $2); } + { + $$= new Item_func_concat($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; + } + | '+' simple_expr %prec NEG + { $$= $2; } + | '-' simple_expr %prec NEG + { + $$= new Item_func_neg($2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | '~' simple_expr %prec NEG + { + $$= new Item_func_bit_neg($2); + if ($$ == NULL) + MYSQL_YYABORT; + } + | not2 simple_expr %prec NEG + { + $$= negate_expression(YYTHD, $2); + if ($$ == NULL) + MYSQL_YYABORT; + } | '(' subselect ')' { $$= new Item_singlerow_subselect($2); + if ($$ == NULL) + MYSQL_YYABORT; } | '(' expr ')' { $$= $2; } | '(' expr ',' expr_list ')' { $4->push_front($2); $$= new Item_row(*$4); + if ($$ == NULL) + MYSQL_YYABORT; } | ROW_SYM '(' expr ',' expr_list ')' { $5->push_front($3); $$= new Item_row(*$5); + if ($$ == NULL) + MYSQL_YYABORT; } | EXISTS '(' subselect ')' { $$= new Item_exists_subselect($3); + if ($$ == NULL) + MYSQL_YYABORT; } - | '{' ident expr '}' { $$= $3; } + | '{' ident expr '}' + { $$= $3; } | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')' - { $2->push_front($5); - Select->add_ftfunc_to_list((Item_func_match*) - ($$=new Item_func_match(*$2,$6))); } - | ASCII_SYM '(' expr ')' { $$= new Item_func_ascii($3); } + { + $2->push_front($5); + Item_func_match *item= new Item_func_match(*$2,$6); + if (item == NULL) + MYSQL_YYABORT; + Select->add_ftfunc_to_list(item); + $$= item; + } + | ASCII_SYM '(' expr ')' + { + $$= new Item_func_ascii($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | BINARY simple_expr %prec NEG { $$= create_func_cast($2, ITEM_CAST_CHAR, NULL, NULL, &my_charset_bin); + if ($$ == NULL) + MYSQL_YYABORT; } | CAST_SYM '(' expr AS cast_type ')' { LEX *lex= Lex; $$= create_func_cast($3, $5, lex->length, lex->dec, lex->charset); - if (!$$) + if ($$ == NULL) MYSQL_YYABORT; } | CASE_SYM opt_expr when_list opt_else END - { $$= new Item_func_case(* $3, $2, $4 ); } + { + $$= new Item_func_case(* $3, $2, $4 ); + if ($$ == NULL) + MYSQL_YYABORT; + } | CONVERT_SYM '(' expr ',' cast_type ')' { $$= create_func_cast($3, $5, Lex->length, Lex->dec, Lex->charset); - if (!$$) + if ($$ == NULL) MYSQL_YYABORT; } | CONVERT_SYM '(' expr USING charset_name ')' - { $$= new Item_func_conv_charset($3,$5); } + { + $$= new Item_func_conv_charset($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | DEFAULT '(' simple_ident ')' { if ($3->is_splocal()) @@ -4842,9 +5123,15 @@ simple_expr: MYSQL_YYABORT; } $$= new Item_default_value(Lex->current_context(), $3); + if ($$ == NULL) + MYSQL_YYABORT; } | VALUES '(' simple_ident_nospvar ')' - { $$= new Item_insert_value(Lex->current_context(), $3); } + { + $$= new Item_insert_value(Lex->current_context(), $3); + if ($$ == NULL) + MYSQL_YYABORT; + } | FUNC_ARG0 '(' ')' { if (!$1.symbol->create_func) @@ -4855,6 +5142,8 @@ simple_expr: MYSQL_YYABORT; } $$= ((Item*(*)(void))($1.symbol->create_func))(); + if ($$ == NULL) + MYSQL_YYABORT; } | FUNC_ARG1 '(' expr ')' { @@ -4866,6 +5155,8 @@ simple_expr: MYSQL_YYABORT; } $$= ((Item*(*)(Item*))($1.symbol->create_func))($3); + if ($$ == NULL) + MYSQL_YYABORT; } | FUNC_ARG2 '(' expr ',' expr ')' { @@ -4877,6 +5168,8 @@ simple_expr: MYSQL_YYABORT; } $$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; } | FUNC_ARG3 '(' expr ',' expr ',' expr ')' { @@ -4888,106 +5181,264 @@ simple_expr: MYSQL_YYABORT; } $$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; } | ADDDATE_SYM '(' expr ',' expr ')' - { $$= new Item_date_add_interval($3, $5, INTERVAL_DAY, 0);} + { + $$= new Item_date_add_interval($3, $5, INTERVAL_DAY, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' - { $$= new Item_date_add_interval($3, $6, $7, 0); } + { + $$= new Item_date_add_interval($3, $6, $7, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } | REPEAT_SYM '(' expr ',' expr ')' - { $$= new Item_func_repeat($3,$5); } + { + $$= new Item_func_repeat($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | ATAN '(' expr ')' - { $$= new Item_func_atan($3); } + { + $$= new Item_func_atan($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | ATAN '(' expr ',' expr ')' - { $$= new Item_func_atan($3,$5); } + { + $$= new Item_func_atan($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | CHAR_SYM '(' expr_list ')' - { $$= new Item_func_char(*$3); } + { + $$= new Item_func_char(*$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | CHAR_SYM '(' expr_list USING charset_name ')' - { $$= new Item_func_char(*$3, $5); } + { + $$= new Item_func_char(*$3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } | CHARSET '(' expr ')' - { $$= new Item_func_charset($3); } + { + $$= new Item_func_charset($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | COALESCE '(' expr_list ')' - { $$= new Item_func_coalesce(* $3); } + { + $$= new Item_func_coalesce(* $3); + if ($$ == NULL) + MYSQL_YYABORT; + } | COLLATION_SYM '(' expr ')' - { $$= new Item_func_collation($3); } + { + $$= new Item_func_collation($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | CONCAT '(' expr_list ')' - { $$= new Item_func_concat(* $3); } + { + $$= new Item_func_concat(* $3); + if ($$ == NULL) + MYSQL_YYABORT; + } | CONCAT_WS '(' expr ',' expr_list ')' - { $5->push_front($3); $$= new Item_func_concat_ws(*$5); } + { + $5->push_front($3); + $$= new Item_func_concat_ws(*$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | CONVERT_TZ_SYM '(' expr ',' expr ',' expr ')' { if (Lex->add_time_zone_tables_to_query_tables(YYTHD)) MYSQL_YYABORT; $$= new Item_func_convert_tz($3, $5, $7); + if ($$ == NULL) + MYSQL_YYABORT; } | CURDATE optional_braces - { $$= new Item_func_curdate_local(); Lex->safe_to_cache_query=0; } + { + $$= new Item_func_curdate_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } | CURTIME optional_braces - { $$= new Item_func_curtime_local(); Lex->safe_to_cache_query=0; } + { + $$= new Item_func_curtime_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } | CURTIME '(' expr ')' { $$= new Item_func_curtime_local($3); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query=0; } | CURRENT_USER optional_braces { $$= new Item_func_current_user(Lex->current_context()); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query= 0; } | DATE_ADD_INTERVAL '(' expr ',' interval_expr interval ')' - { $$= new Item_date_add_interval($3,$5,$6,0); } + { + $$= new Item_date_add_interval($3,$5,$6,0); + if ($$ == NULL) + MYSQL_YYABORT; + } | DATE_SUB_INTERVAL '(' expr ',' interval_expr interval ')' - { $$= new Item_date_add_interval($3,$5,$6,1); } + { + $$= new Item_date_add_interval($3,$5,$6,1); + if ($$ == NULL) + MYSQL_YYABORT; + } | DATABASE '(' ')' { $$= new Item_func_database(); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query=0; } | DATE_SYM '(' expr ')' - { $$= new Item_date_typecast($3); } + { + $$= new Item_date_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | DAY_SYM '(' expr ')' - { $$= new Item_func_dayofmonth($3); } + { + $$= new Item_func_dayofmonth($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | ELT_FUNC '(' expr ',' expr_list ')' - { $5->push_front($3); $$= new Item_func_elt(*$5); } + { + $5->push_front($3); + $$= new Item_func_elt(*$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | MAKE_SET_SYM '(' expr ',' expr_list ')' - { $$= new Item_func_make_set($3, *$5); } + { + $$= new Item_func_make_set($3, *$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | ENCRYPT '(' expr ')' { $$= new Item_func_encrypt($3); + if ($$ == NULL) + MYSQL_YYABORT; Lex->uncacheable(UNCACHEABLE_RAND); } - | ENCRYPT '(' expr ',' expr ')' { $$= new Item_func_encrypt($3,$5); } + | ENCRYPT '(' expr ',' expr ')' + { + $$= new Item_func_encrypt($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | DECODE_SYM '(' expr ',' TEXT_STRING_literal ')' - { $$= new Item_func_decode($3,$5.str); } + { + $$= new Item_func_decode($3,$5.str); + if ($$ == NULL) + MYSQL_YYABORT; + } | ENCODE_SYM '(' expr ',' TEXT_STRING_literal ')' - { $$= new Item_func_encode($3,$5.str); } + { + $$= new Item_func_encode($3,$5.str); + if ($$ == NULL) + MYSQL_YYABORT; + } | DES_DECRYPT_SYM '(' expr ')' - { $$= new Item_func_des_decrypt($3); } + { + $$= new Item_func_des_decrypt($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | DES_DECRYPT_SYM '(' expr ',' expr ')' - { $$= new Item_func_des_decrypt($3,$5); } + { + $$= new Item_func_des_decrypt($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | DES_ENCRYPT_SYM '(' expr ')' - { $$= new Item_func_des_encrypt($3); } + { + $$= new Item_func_des_encrypt($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | DES_ENCRYPT_SYM '(' expr ',' expr ')' - { $$= new Item_func_des_encrypt($3,$5); } + { + $$= new Item_func_des_encrypt($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | EXPORT_SET '(' expr ',' expr ',' expr ')' - { $$= new Item_func_export_set($3, $5, $7); } + { + $$= new Item_func_export_set($3, $5, $7); + if ($$ == NULL) + MYSQL_YYABORT; + } | EXPORT_SET '(' expr ',' expr ',' expr ',' expr ')' - { $$= new Item_func_export_set($3, $5, $7, $9); } + { + $$= new Item_func_export_set($3, $5, $7, $9); + if ($$ == NULL) + MYSQL_YYABORT; + } | EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')' - { $$= new Item_func_export_set($3, $5, $7, $9, $11); } + { + $$= new Item_func_export_set($3, $5, $7, $9, $11); + if ($$ == NULL) + MYSQL_YYABORT; + } | FORMAT_SYM '(' expr ',' NUM ')' - { $$= new Item_func_format($3,atoi($5.str)); } + { + $$= new Item_func_format($3,atoi($5.str)); + if ($$ == NULL) + MYSQL_YYABORT; + } | FROM_UNIXTIME '(' expr ')' - { $$= new Item_func_from_unixtime($3); } + { + $$= new Item_func_from_unixtime($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | FROM_UNIXTIME '(' expr ',' expr ')' { - $$= new Item_func_date_format (new Item_func_from_unixtime($3),$5,0); + Item *item= new Item_func_from_unixtime($3); + if (item == NULL) + MYSQL_YYABORT; + $$= new Item_func_date_format (item, $5, 0); + if ($$ == NULL) + MYSQL_YYABORT; } | FIELD_FUNC '(' expr ',' expr_list ')' - { $5->push_front($3); $$= new Item_func_field(*$5); } + { + $5->push_front($3); + $$= new Item_func_field(*$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | geometry_function { #ifdef HAVE_SPATIAL $$= $1; + /* $1 may be NULL, GEOM_NEW not tested for out of memory */ + if ($$ == NULL) + MYSQL_YYABORT; #else my_error(ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name, sym_group_geom.needed_define); @@ -4995,16 +5446,36 @@ simple_expr: #endif } | GET_FORMAT '(' date_time_type ',' expr ')' - { $$= new Item_func_get_format($3, $5); } + { + $$= new Item_func_get_format($3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } | HOUR_SYM '(' expr ')' - { $$= new Item_func_hour($3); } + { + $$= new Item_func_hour($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | IF '(' expr ',' expr ',' expr ')' - { $$= new Item_func_if($3,$5,$7); } + { + $$= new Item_func_if($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } | INSERT '(' expr ',' expr ',' expr ',' expr ')' - { $$= new Item_func_insert($3,$5,$7,$9); } + { + $$= new Item_func_insert($3,$5,$7,$9); + if ($$ == NULL) + MYSQL_YYABORT; + } | interval_expr interval '+' expr /* we cannot put interval before - */ - { $$= new Item_date_add_interval($4,$1,$2,0); } + { + $$= new Item_date_add_interval($4,$1,$2,0); + if ($$ == NULL) + MYSQL_YYABORT; + } | interval_expr { if ($1->type() != Item::ROW_ITEM) @@ -5013,102 +5484,248 @@ simple_expr: MYSQL_YYABORT; } $$= new Item_func_interval((Item_row *)$1); + if ($$ == NULL) + MYSQL_YYABORT; } | LAST_INSERT_ID '(' ')' { $$= new Item_func_last_insert_id(); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query= 0; } | LAST_INSERT_ID '(' expr ')' { $$= new Item_func_last_insert_id($3); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query= 0; } | LEFT '(' expr ',' expr ')' - { $$= new Item_func_left($3,$5); } + { + $$= new Item_func_left($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | LOCATE '(' expr ',' expr ')' - { $$= new Item_func_locate($5,$3); } + { + $$= new Item_func_locate($5,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | LOCATE '(' expr ',' expr ',' expr ')' - { $$= new Item_func_locate($5,$3,$7); } + { + $$= new Item_func_locate($5,$3,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } | GREATEST_SYM '(' expr ',' expr_list ')' - { $5->push_front($3); $$= new Item_func_max(*$5); } + { + $5->push_front($3); + $$= new Item_func_max(*$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | LEAST_SYM '(' expr ',' expr_list ')' - { $5->push_front($3); $$= new Item_func_min(*$5); } + { + $5->push_front($3); + $$= new Item_func_min(*$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | LOG_SYM '(' expr ')' - { $$= new Item_func_log($3); } + { + $$= new Item_func_log($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | LOG_SYM '(' expr ',' expr ')' - { $$= new Item_func_log($3, $5); } + { + $$= new Item_func_log($3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } | MASTER_POS_WAIT '(' expr ',' expr ')' { $$= new Item_master_pos_wait($3, $5); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query=0; - } + } | MASTER_POS_WAIT '(' expr ',' expr ',' expr ')' { $$= new Item_master_pos_wait($3, $5, $7); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query=0; } | MICROSECOND_SYM '(' expr ')' - { $$= new Item_func_microsecond($3); } + { + $$= new Item_func_microsecond($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | MINUTE_SYM '(' expr ')' - { $$= new Item_func_minute($3); } + { + $$= new Item_func_minute($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | MOD_SYM '(' expr ',' expr ')' - { $$ = new Item_func_mod( $3, $5); } + { + $$= new Item_func_mod( $3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } | MONTH_SYM '(' expr ')' - { $$= new Item_func_month($3); } + { + $$= new Item_func_month($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | NOW_SYM optional_braces - { $$= new Item_func_now_local(); Lex->safe_to_cache_query=0;} + { + $$= new Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } | NOW_SYM '(' expr ')' - { $$= new Item_func_now_local($3); Lex->safe_to_cache_query=0;} + { + $$= new Item_func_now_local($3); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } | PASSWORD '(' expr ')' { $$= YYTHD->variables.old_passwords ? (Item *) new Item_func_old_password($3) : (Item *) new Item_func_password($3); + if ($$ == NULL) + MYSQL_YYABORT; } | OLD_PASSWORD '(' expr ')' - { $$= new Item_func_old_password($3); } + { + $$= new Item_func_old_password($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | POSITION_SYM '(' bit_expr IN_SYM expr ')' - { $$ = new Item_func_locate($5,$3); } + { + $$= new Item_func_locate($5,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | QUARTER_SYM '(' expr ')' - { $$ = new Item_func_quarter($3); } + { + $$= new Item_func_quarter($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | RAND '(' expr ')' - { $$= new Item_func_rand($3); Lex->uncacheable(UNCACHEABLE_RAND);} + { + $$= new Item_func_rand($3); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->uncacheable(UNCACHEABLE_RAND); + } | RAND '(' ')' - { $$= new Item_func_rand(); Lex->uncacheable(UNCACHEABLE_RAND);} + { + $$= new Item_func_rand(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->uncacheable(UNCACHEABLE_RAND); + } | REPLACE '(' expr ',' expr ',' expr ')' - { $$= new Item_func_replace($3,$5,$7); } + { + $$= new Item_func_replace($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } | RIGHT '(' expr ',' expr ')' - { $$= new Item_func_right($3,$5); } + { + $$= new Item_func_right($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | ROUND '(' expr ')' - { $$= new Item_func_round($3, new Item_int((char*)"0",0,1),0); } - | ROUND '(' expr ',' expr ')' { $$= new Item_func_round($3,$5,0); } + { + Item *item= new Item_int((char*)"0",0,1); + if (item == NULL) + MYSQL_YYABORT; + $$= new Item_func_round($3, item, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ROUND '(' expr ',' expr ')' + { + $$= new Item_func_round($3,$5,0); + if ($$ == NULL) + MYSQL_YYABORT; + } | ROW_COUNT_SYM '(' ')' { $$= new Item_func_row_count(); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query= 0; } | SUBDATE_SYM '(' expr ',' expr ')' - { $$= new Item_date_add_interval($3, $5, INTERVAL_DAY, 1);} + { + $$= new Item_date_add_interval($3, $5, INTERVAL_DAY, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' - { $$= new Item_date_add_interval($3, $6, $7, 1); } + { + $$= new Item_date_add_interval($3, $6, $7, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } | SECOND_SYM '(' expr ')' - { $$= new Item_func_second($3); } + { + $$= new Item_func_second($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | SUBSTRING '(' expr ',' expr ',' expr ')' - { $$= new Item_func_substr($3,$5,$7); } + { + $$= new Item_func_substr($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } | SUBSTRING '(' expr ',' expr ')' - { $$= new Item_func_substr($3,$5); } + { + $$= new Item_func_substr($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | SUBSTRING '(' expr FROM expr FOR_SYM expr ')' - { $$= new Item_func_substr($3,$5,$7); } + { + $$= new Item_func_substr($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } | SUBSTRING '(' expr FROM expr ')' - { $$= new Item_func_substr($3,$5); } + { + $$= new Item_func_substr($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | SUBSTRING_INDEX '(' expr ',' expr ',' expr ')' - { $$= new Item_func_substr_index($3,$5,$7); } + { + $$= new Item_func_substr_index($3,$5,$7); + if ($$ == NULL) + MYSQL_YYABORT; + } | SYSDATE optional_braces { if (global_system_variables.sysdate_is_now == 0) $$= new Item_func_sysdate_local(); else $$= new Item_func_now_local(); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query=0; } | SYSDATE '(' expr ')' @@ -5116,36 +5733,94 @@ simple_expr: if (global_system_variables.sysdate_is_now == 0) $$= new Item_func_sysdate_local($3); else $$= new Item_func_now_local($3); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query=0; } | TIME_SYM '(' expr ')' - { $$= new Item_time_typecast($3); } + { + $$= new Item_time_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | TIMESTAMP '(' expr ')' - { $$= new Item_datetime_typecast($3); } + { + $$= new Item_datetime_typecast($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | TIMESTAMP '(' expr ',' expr ')' - { $$= new Item_func_add_time($3, $5, 1, 0); } + { + $$= new Item_func_add_time($3, $5, 1, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } | TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')' - { $$= new Item_date_add_interval($7,$5,$3,0); } + { + $$= new Item_date_add_interval($7,$5,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } | TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')' - { $$= new Item_func_timestamp_diff($5,$7,$3); } + { + $$= new Item_func_timestamp_diff($5,$7,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRIM '(' expr ')' - { $$= new Item_func_trim($3); } + { + $$= new Item_func_trim($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRIM '(' LEADING expr FROM expr ')' - { $$= new Item_func_ltrim($6,$4); } + { + $$= new Item_func_ltrim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRIM '(' TRAILING expr FROM expr ')' - { $$= new Item_func_rtrim($6,$4); } + { + $$= new Item_func_rtrim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRIM '(' BOTH expr FROM expr ')' - { $$= new Item_func_trim($6,$4); } + { + $$= new Item_func_trim($6,$4); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRIM '(' LEADING FROM expr ')' - { $$= new Item_func_ltrim($5); } + { + $$= new Item_func_ltrim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRIM '(' TRAILING FROM expr ')' - { $$= new Item_func_rtrim($5); } + { + $$= new Item_func_rtrim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRIM '(' BOTH FROM expr ')' - { $$= new Item_func_trim($5); } + { + $$= new Item_func_trim($5); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRIM '(' expr FROM expr ')' - { $$= new Item_func_trim($5,$3); } + { + $$= new Item_func_trim($5,$3); + if ($$ == NULL) + MYSQL_YYABORT; + } | TRUNCATE_SYM '(' expr ',' expr ')' - { $$= new Item_func_round($3,$5,1); } + { + $$= new Item_func_round($3,$5,1); + if ($$ == NULL) + MYSQL_YYABORT; + } | ident '.' ident '(' opt_expr_list ')' { LEX *lex= Lex; @@ -5158,6 +5833,8 @@ simple_expr: $$= new Item_func_sp(Lex->current_context(), name, *$5); else $$= new Item_func_sp(Lex->current_context(), name); + if ($$ == NULL) + MYSQL_YYABORT; lex->safe_to_cache_query=0; } | IDENT_sys '(' @@ -5298,47 +5975,110 @@ simple_expr: else $$= new Item_func_sp(Lex->current_context(), name); } - lex->safe_to_cache_query=0; + lex->safe_to_cache_query=0; + + if ($$ == NULL) + MYSQL_YYABORT; } | UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')' { $$= new Item_func_unique_users($3,atoi($5.str),atoi($7.str), * $9); + if ($$ == NULL) + MYSQL_YYABORT; } | UNIX_TIMESTAMP '(' ')' { $$= new Item_func_unix_timestamp(); + if ($$ == NULL) + MYSQL_YYABORT; Lex->safe_to_cache_query=0; } | UNIX_TIMESTAMP '(' expr ')' - { $$= new Item_func_unix_timestamp($3); } + { + $$= new Item_func_unix_timestamp($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | USER '(' ')' - { $$= new Item_func_user(); Lex->safe_to_cache_query=0; } + { + $$= new Item_func_user(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } | UTC_DATE_SYM optional_braces - { $$= new Item_func_curdate_utc(); Lex->safe_to_cache_query=0;} + { + $$= new Item_func_curdate_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } | UTC_TIME_SYM optional_braces - { $$= new Item_func_curtime_utc(); Lex->safe_to_cache_query=0;} + { + $$= new Item_func_curtime_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } | UTC_TIMESTAMP_SYM optional_braces - { $$= new Item_func_now_utc(); Lex->safe_to_cache_query=0;} + { + $$= new Item_func_now_utc(); + if ($$ == NULL) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } | WEEK_SYM '(' expr ')' { - $$= new Item_func_week($3,new Item_int((char*) "0", - YYTHD->variables.default_week_format,1)); + Item *item= new Item_int((char*) "0", + YYTHD->variables.default_week_format, + 1); + if (item == NULL) + MYSQL_YYABORT; + $$= new Item_func_week($3, item); + if ($$ == NULL) + MYSQL_YYABORT; } | WEEK_SYM '(' expr ',' expr ')' - { $$= new Item_func_week($3,$5); } + { + $$= new Item_func_week($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; + } | YEAR_SYM '(' expr ')' - { $$= new Item_func_year($3); } + { + $$= new Item_func_year($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | YEARWEEK '(' expr ')' - { $$= new Item_func_yearweek($3,new Item_int((char*) "0",0,1)); } + { + Item *item= new Item_int((char*) "0",0,1); + if (item == NULL) + MYSQL_YYABORT; + $$= new Item_func_yearweek($3, item); + if ($$ == NULL) + MYSQL_YYABORT; + } | YEARWEEK '(' expr ',' expr ')' - { $$= new Item_func_yearweek($3, $5); } + { + $$= new Item_func_yearweek($3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } | BENCHMARK_SYM '(' ulong_num ',' expr ')' { $$=new Item_func_benchmark($3,$5); + if ($$ == NULL) + MYSQL_YYABORT; Lex->uncacheable(UNCACHEABLE_SIDEEFFECT); } | EXTRACT_SYM '(' interval FROM expr ')' - { $$=new Item_extract( $3, $5); }; + { + $$=new Item_extract( $3, $5); + if ($$ == NULL) + MYSQL_YYABORT; + } + ; geometry_function: CONTAINS_SYM '(' expr ',' expr ')' @@ -5414,7 +6154,12 @@ udf_expr_list: ; udf_expr_list2: - { Select->expr_list.push_front(new List); } + { + List *list= new List; + if (list == NULL) + MYSQL_YYABORT; + Select->expr_list.push_front(list); + } udf_expr_list3 { $$= Select->expr_list.pop(); } ; @@ -5462,53 +6207,132 @@ udf_expr: ; sum_expr: - AVG_SYM '(' in_sum_expr ')' - { $$=new Item_sum_avg($3); } + AVG_SYM '(' in_sum_expr ')' + { + $$=new Item_sum_avg($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | AVG_SYM '(' DISTINCT in_sum_expr ')' - { $$=new Item_sum_avg_distinct($4); } + { + $$=new Item_sum_avg_distinct($4); + if ($$ == NULL) + MYSQL_YYABORT; + } | BIT_AND '(' in_sum_expr ')' - { $$=new Item_sum_and($3); } + { + $$=new Item_sum_and($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | BIT_OR '(' in_sum_expr ')' - { $$=new Item_sum_or($3); } + { + $$=new Item_sum_or($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | BIT_XOR '(' in_sum_expr ')' - { $$=new Item_sum_xor($3); } + { + $$=new Item_sum_xor($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | COUNT_SYM '(' opt_all '*' ')' - { $$=new Item_sum_count(new Item_int((int32) 0L,1)); } + { + Item *item= new Item_int((int32) 0L,1); + if (item == NULL) + MYSQL_YYABORT; + $$=new Item_sum_count(new Item_int((int32) 0L,1)); + if ($$ == NULL) + MYSQL_YYABORT; + } | COUNT_SYM '(' in_sum_expr ')' - { $$=new Item_sum_count($3); } + { + $$=new Item_sum_count($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | COUNT_SYM '(' DISTINCT { Select->in_sum_expr++; } expr_list { Select->in_sum_expr--; } ')' - { $$=new Item_sum_count_distinct(* $5); } + { + $$=new Item_sum_count_distinct(* $5); + if ($$ == NULL) + MYSQL_YYABORT; + } | GROUP_UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' in_sum_expr ')' - { $$= new Item_sum_unique_users($3,atoi($5.str),atoi($7.str),$9); } + { + $$= new Item_sum_unique_users($3,atoi($5.str),atoi($7.str),$9); + if ($$ == NULL) + MYSQL_YYABORT; + } | MIN_SYM '(' in_sum_expr ')' - { $$=new Item_sum_min($3); } + { + $$=new Item_sum_min($3); + if ($$ == NULL) + MYSQL_YYABORT; + } /* According to ANSI SQL, DISTINCT is allowed and has no sence inside MIN and MAX grouping functions; so MIN|MAX(DISTINCT ...) is processed like an ordinary MIN | MAX() */ | MIN_SYM '(' DISTINCT in_sum_expr ')' - { $$=new Item_sum_min($4); } + { + $$=new Item_sum_min($4); + if ($$ == NULL) + MYSQL_YYABORT; + } | MAX_SYM '(' in_sum_expr ')' - { $$=new Item_sum_max($3); } + { + $$=new Item_sum_max($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | MAX_SYM '(' DISTINCT in_sum_expr ')' - { $$=new Item_sum_max($4); } + { + $$=new Item_sum_max($4); + if ($$ == NULL) + MYSQL_YYABORT; + } | STD_SYM '(' in_sum_expr ')' - { $$=new Item_sum_std($3, 0); } + { + $$=new Item_sum_std($3, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } | VARIANCE_SYM '(' in_sum_expr ')' - { $$=new Item_sum_variance($3, 0); } + { + $$=new Item_sum_variance($3, 0); + if ($$ == NULL) + MYSQL_YYABORT; + } | STDDEV_SAMP_SYM '(' in_sum_expr ')' - { $$=new Item_sum_std($3, 1); } + { + $$=new Item_sum_std($3, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } | VAR_SAMP_SYM '(' in_sum_expr ')' - { $$=new Item_sum_variance($3, 1); } + { + $$=new Item_sum_variance($3, 1); + if ($$ == NULL) + MYSQL_YYABORT; + } | SUM_SYM '(' in_sum_expr ')' - { $$=new Item_sum_sum($3); } + { + $$=new Item_sum_sum($3); + if ($$ == NULL) + MYSQL_YYABORT; + } | SUM_SYM '(' DISTINCT in_sum_expr ')' - { $$=new Item_sum_sum_distinct($4); } + { + $$=new Item_sum_sum_distinct($4); + if ($$ == NULL) + MYSQL_YYABORT; + } | GROUP_CONCAT_SYM '(' opt_distinct { Select->in_sum_expr++; } expr_list opt_gorder_clause @@ -5519,6 +6343,8 @@ sum_expr: sel->in_sum_expr--; $$=new Item_func_group_concat(Lex->current_context(), $3, $5, sel->gorder_list, $7); + if ($$ == NULL) + MYSQL_YYABORT; $5->empty(); }; @@ -5541,12 +6367,16 @@ variable_aux: ident_or_text SET_VAR expr { $$= new Item_func_set_user_var($1, $3); + if ($$ == NULL) + MYSQL_YYABORT; LEX *lex= Lex; lex->uncacheable(UNCACHEABLE_RAND); } | ident_or_text { $$= new Item_func_get_user_var($1); + if ($$ == NULL) + MYSQL_YYABORT; LEX *lex= Lex; lex->uncacheable(UNCACHEABLE_RAND); } @@ -5567,11 +6397,14 @@ opt_distinct: |DISTINCT { $$ = 1; }; opt_gconcat_separator: - /* empty */ - { - $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1); - } - | SEPARATOR_SYM text_string { $$ = $2; }; + /* empty */ + { + $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | SEPARATOR_SYM text_string { $$ = $2; } + ; opt_gorder_clause: @@ -5585,6 +6418,8 @@ opt_gorder_clause: select->gorder_list= (SQL_LIST*) sql_memdup((char*) &select->order_list, sizeof(st_sql_list)); + if (select->gorder_list == NULL) + MYSQL_YYABORT; select->order_list.empty(); }; @@ -5625,7 +6460,12 @@ opt_expr_list: ; expr_list: - { Select->expr_list.push_front(new List); } + { + List *list= new List; + if (list == NULL) + MYSQL_YYABORT; + Select->expr_list.push_front(list); + } expr_list2 { $$= Select->expr_list.pop(); }; @@ -5638,7 +6478,12 @@ ident_list_arg: | '(' ident_list ')' { $$= $2; }; ident_list: - { Select->expr_list.push_front(new List); } + { + List *list= new List; + if (list == NULL) + MYSQL_YYABORT; + Select->expr_list.push_front(new List); + } ident_list2 { $$= Select->expr_list.pop(); }; @@ -5658,6 +6503,8 @@ when_list: WHEN_SYM expr THEN_SYM expr { $$= new List; + if ($$ == NULL) + MYSQL_YYABORT; $$->push_back($2); $$->push_back($4); } @@ -6064,32 +6911,53 @@ key_list_or_empty: key_usage_list2: key_usage_list2 ',' ident - { Select-> - interval_list.push_back(new (YYTHD->mem_root) String((const char*) $3.str, $3.length, - system_charset_info)); } + { + String *s= new (YYTHD->mem_root) String((const char*) $3.str, + $3.length, + system_charset_info); + if (s == NULL) + MYSQL_YYABORT; + Select->interval_list.push_back(s); + } | ident - { Select-> - interval_list.push_back(new (YYTHD->mem_root) String((const char*) $1.str, $1.length, - system_charset_info)); } + { + String *s= new (YYTHD->mem_root) String((const char*) $1.str, + $1.length, + system_charset_info); + if (s == NULL) + MYSQL_YYABORT; + Select->interval_list.push_back(s); + } | PRIMARY_SYM - { Select-> - interval_list.push_back(new (YYTHD->mem_root) String("PRIMARY", 7, - system_charset_info)); }; + { + String *s= new (YYTHD->mem_root) String("PRIMARY", 7, + system_charset_info); + if (s == NULL) + MYSQL_YYABORT; + Select->interval_list.push_back(s); + } + ; using_list: ident { if (!($$= new List)) MYSQL_YYABORT; - $$->push_back(new (YYTHD->mem_root) - String((const char *) $1.str, $1.length, - system_charset_info)); + String *s= new (YYTHD->mem_root) String((const char *) $1.str, + $1.length, + system_charset_info); + if (s == NULL) + MYSQL_YYABORT; + $$->push_back(s); } | using_list ',' ident { - $1->push_back(new (YYTHD->mem_root) - String((const char *) $3.str, $3.length, - system_charset_info)); + String *s= new (YYTHD->mem_root) String((const char *) $3.str, + $3.length, + system_charset_info); + if (s == NULL) + MYSQL_YYABORT; + $1->push_back(s); $$= $1; }; @@ -6154,7 +7022,12 @@ table_alias: opt_table_alias: /* empty */ { $$=0; } | table_alias ident - { $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); }; + { + $$= (LEX_STRING*) sql_memdup(&$2,sizeof(LEX_STRING)); + if ($$ == NULL) + MYSQL_YYABORT; + } + ; opt_all: /* empty */ @@ -6205,6 +7078,8 @@ opt_escape: $$= ((YYTHD->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ? new Item_string("", 0, &my_charset_latin1) : new Item_string("\\", 1, &my_charset_latin1)); + if ($$ == NULL) + MYSQL_YYABORT; } ; @@ -6375,9 +7250,24 @@ limit_option: { ((Item_param *) $1)->limit_clause_param= TRUE; } - | ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); } - | LONG_NUM { $$= new Item_uint($1.str, $1.length); } - | NUM { $$= new Item_uint($1.str, $1.length); } + | ULONGLONG_NUM + { + $$= new Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | LONG_NUM + { + $$= new Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | NUM + { + $$= new Item_uint($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } ; delete_limit_clause: @@ -6430,10 +7320,11 @@ procedure_clause: lex->proc_list.elements=0; lex->proc_list.first=0; lex->proc_list.next= (byte**) &lex->proc_list.first; - if (add_proc_to_list(lex->thd, new Item_field(&lex-> - current_select-> - context, - NULL,NULL,$2.str))) + Item_field *item= new Item_field(&lex->current_select->context, + NULL,NULL,$2.str); + if (item == NULL) + MYSQL_YYABORT; + if (add_proc_to_list(lex->thd, item)) MYSQL_YYABORT; Lex->uncacheable(UNCACHEABLE_SIDEEFFECT); } @@ -6484,13 +7375,20 @@ select_var_ident: { LEX *lex=Lex; if (lex->result) - ((select_dumpvar *)lex->result)->var_list.push_back( new my_var($2,0,0,(enum_field_types)0)); + { + my_var *var= new my_var($2,0,0,(enum_field_types)0); + if (var == NULL) + MYSQL_YYABORT; + ((select_dumpvar *)lex->result)->var_list.push_back(var); + } else + { /* The parser won't create select_result instance only if it's an EXPLAIN. */ DBUG_ASSERT(lex->describe); + } } | ident_or_text { @@ -6504,12 +7402,12 @@ select_var_ident: } if (lex->result) { - my_var *var; - ((select_dumpvar *)lex->result)-> - var_list.push_back(var= new my_var($1,1,t->offset,t->type)); + my_var *var= new my_var($1,1,t->offset,t->type); + if (var == NULL) + MYSQL_YYABORT; + ((select_dumpvar *)lex->result)->var_list.push_back(var); #ifndef DBUG_OFF - if (var) - var->sp= lex->sphead; + var->sp= lex->sphead; #endif } else @@ -6594,11 +7492,13 @@ drop: | DROP INDEX_SYM ident ON table_ident {} { LEX *lex=Lex; + Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $3.str); + if (ad == NULL) + MYSQL_YYABORT; lex->sql_command= SQLCOM_DROP_INDEX; lex->alter_info.reset(); lex->alter_info.flags= ALTER_DROP_INDEX; - lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::KEY, - $3.str)); + lex->alter_info.drop_list.push_back(ad); if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL, TL_OPTION_UPDATING)) MYSQL_YYABORT; @@ -6623,6 +7523,8 @@ drop: lex->sql_command = SQLCOM_DROP_FUNCTION; lex->drop_if_exists= $3; spname= new sp_name($4, $6, true); + if (spname == NULL) + MYSQL_YYABORT; spname->init_qname(thd); lex->spname= spname; } @@ -6642,6 +7544,8 @@ drop: lex->sql_command = SQLCOM_DROP_FUNCTION; lex->drop_if_exists= $3; spname= new sp_name(db, $4, false); + if (spname == NULL) + MYSQL_YYABORT; spname->init_qname(thd); lex->spname= spname; } @@ -6856,7 +7760,12 @@ values: expr_or_default: expr { $$= $1;} - | DEFAULT {$$= new Item_default_value(Lex->current_context()); } + | DEFAULT + { + $$= new Item_default_value(Lex->current_context()); + if ($$ == NULL) + MYSQL_YYABORT; + } ; opt_insert_update: @@ -6974,15 +7883,21 @@ table_wild_list: table_wild_one: ident opt_wild opt_table_alias { - if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3, + Table_ident *ti= new Table_ident($1); + if (ti == NULL) + MYSQL_YYABORT; + if (!Select->add_table_to_list(YYTHD, ti, $3, TL_OPTION_UPDATING | TL_OPTION_ALIAS, Lex->lock_option)) MYSQL_YYABORT; } | ident '.' ident opt_wild opt_table_alias { + Table_ident *ti= new Table_ident(YYTHD, $1, $3, 0); + if (ti == NULL) + MYSQL_YYABORT; if (!Select->add_table_to_list(YYTHD, - new Table_ident(YYTHD, $1, $3, 0), + ti, $5, TL_OPTION_UPDATING | TL_OPTION_ALIAS, @@ -7360,8 +8275,12 @@ binlog_from: wild_and_where: /* empty */ | LIKE TEXT_STRING_sys - { Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length, - system_charset_info); } + { + Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length, + system_charset_info); + if (Lex->wild == NULL) + MYSQL_YYABORT; + } | WHERE expr { Select->where= $2; @@ -7409,7 +8328,14 @@ opt_describe_column: /* empty */ {} | text_string { Lex->wild= $1; } | ident - { Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); }; + { + Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str, + $1.length, + system_charset_info); + if (Lex->wild == NULL) + MYSQL_YYABORT; + } + ; /* flush things */ @@ -7696,7 +8622,11 @@ fields_or_vars: field_or_var: simple_ident_nospvar {$$= $1;} | '@' ident_or_text - { $$= new Item_user_var_as_out_param($2); } + { + $$= new Item_user_var_as_out_param($2); + if ($$ == NULL) + MYSQL_YYABORT; + } ; opt_load_data_set_spec: @@ -7721,9 +8651,14 @@ text_literal: my_charset_is_ascii_based(cs_con))) tmp= $1; else - thd->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli); + { + if (thd->convert_string(&tmp, cs_con, $1.str, $1.length, cs_cli)) + MYSQL_YYABORT; + } $$= new Item_string(tmp.str, tmp.length, cs_con, DERIVATION_COERCIBLE, repertoire); + if ($$ == NULL) + MYSQL_YYABORT; } | NCHAR_STRING { @@ -7732,10 +8667,14 @@ text_literal: DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info)); $$= new Item_string($1.str, $1.length, national_charset_info, DERIVATION_COERCIBLE, repertoire); + if ($$ == NULL) + MYSQL_YYABORT; } | UNDERSCORE_CHARSET TEXT_STRING { $$= new Item_string($2.str, $2.length, Lex->underscore_charset); + if ($$ == NULL) + MYSQL_YYABORT; ((Item_string*) $$)->set_repertoire_from_value(); } | text_literal TEXT_STRING_literal @@ -7757,28 +8696,37 @@ text_literal: ; text_string: - TEXT_STRING_literal - { $$= new (YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); } + TEXT_STRING_literal + { + $$= new (YYTHD->mem_root) String($1.str, + $1.length, + YYTHD->variables.collation_connection); + if ($$ == NULL) + MYSQL_YYABORT; + } | HEX_NUM { Item *tmp= new Item_hex_string($1.str, $1.length); + if (tmp == NULL) + MYSQL_YYABORT; /* it is OK only emulate fix_fields, because we need only value of constant */ - $$= tmp ? - tmp->quick_fix_field(), tmp->val_str((String*) 0) : - (String*) 0; + tmp->quick_fix_field(); + $$= tmp->val_str((String*) 0); } | BIN_NUM { Item *tmp= new Item_bin_string($1.str, $1.length); + if (tmp == NULL) + MYSQL_YYABORT; /* it is OK only emulate fix_fields, because we need only value of constant */ - $$= tmp ? tmp->quick_fix_field(), tmp->val_str((String*) 0) : - (String*) 0; + tmp->quick_fix_field(); + $$= tmp->val_str((String*) 0); } ; @@ -7820,76 +8768,121 @@ literal: | NULL_SYM { $$ = new Item_null(); + if ($$ == NULL) + MYSQL_YYABORT; YYTHD->m_lip->next_state=MY_LEX_OPERATOR_OR_IDENT; } - | FALSE_SYM { $$= new Item_int((char*) "FALSE",0,1); } - | TRUE_SYM { $$= new Item_int((char*) "TRUE",1,1); } - | HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);} - | BIN_NUM { $$= new Item_bin_string($1.str, $1.length); } + | FALSE_SYM + { + $$= new Item_int((char*) "FALSE",0,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | TRUE_SYM + { + $$= new Item_int((char*) "TRUE",1,1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | HEX_NUM + { + $$= new Item_hex_string($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BIN_NUM + { + $$= new Item_bin_string($1.str, $1.length); + if ($$ == NULL) + MYSQL_YYABORT; + } | UNDERSCORE_CHARSET HEX_NUM { Item *tmp= new Item_hex_string($2.str, $2.length); + if (tmp == NULL) + MYSQL_YYABORT; /* it is OK only emulate fix_fieds, because we need only value of constant */ - String *str= tmp ? - tmp->quick_fix_field(), tmp->val_str((String*) 0) : - (String*) 0; - $$= new Item_string(NULL, /* name will be set in select_item */ - str ? str->ptr() : "", - str ? str->length() : 0, - Lex->underscore_charset); - if (!$$ || !$$->check_well_formed_result(&$$->str_value, TRUE)) + tmp->quick_fix_field(); + String *str= tmp->val_str((String*) 0); + Item_string *item_str; + item_str= new Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", + str ? str->length() : 0, + Lex->underscore_charset); + if (!item_str || + !item_str->check_well_formed_result(&item_str->str_value, TRUE)) { MYSQL_YYABORT; } - ((Item_string *) $$)->set_repertoire_from_value(); + item_str->set_repertoire_from_value(); + $$= item_str; } | UNDERSCORE_CHARSET BIN_NUM { Item *tmp= new Item_bin_string($2.str, $2.length); + if (tmp == NULL) + MYSQL_YYABORT; /* it is OK only emulate fix_fieds, because we need only value of constant */ - String *str= tmp ? - tmp->quick_fix_field(), tmp->val_str((String*) 0) : - (String*) 0; - $$= new Item_string(NULL, /* name will be set in select_item */ - str ? str->ptr() : "", - str ? str->length() : 0, - Lex->underscore_charset); - if (!$$ || !$$->check_well_formed_result(&$$->str_value, TRUE)) + tmp->quick_fix_field(); + String *str= tmp->val_str((String*) 0); + Item_string *item_str; + item_str= new Item_string(NULL, /* name will be set in select_item */ + str ? str->ptr() : "", + str ? str->length() : 0, + Lex->underscore_charset); + if (!item_str || + !item_str->check_well_formed_result(&item_str->str_value, TRUE)) { MYSQL_YYABORT; } + $$= item_str; } | DATE_SYM text_literal { $$ = $2; } | TIME_SYM text_literal { $$ = $2; } | TIMESTAMP text_literal { $$ = $2; }; NUM_literal: - NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); } - | LONG_NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); } - | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } + NUM + { + int error; + $$ = new Item_int($1.str, + (longlong) my_strtoll10($1.str, NULL, &error), + $1.length); + } + | LONG_NUM + { + int error; + $$ = new Item_int($1.str, + (longlong) my_strtoll10($1.str, NULL, &error), + $1.length); + } + | ULONGLONG_NUM + { + $$= new Item_uint($1.str, $1.length); + } | DECIMAL_NUM - { - $$= new Item_decimal($1.str, $1.length, YYTHD->charset()); - if (YYTHD->net.report_error) - { - MYSQL_YYABORT; - } - } + { + $$= new Item_decimal($1.str, $1.length, YYTHD->charset()); + if (($$ == NULL) || (YYTHD->net.report_error)) + { + MYSQL_YYABORT; + } + } | FLOAT_NUM - { - $$ = new Item_float($1.str, $1.length); - if (YYTHD->net.report_error) - { - MYSQL_YYABORT; - } - } - ; + { + $$= new Item_float($1.str, $1.length); + if (($$ == NULL) || (YYTHD->net.report_error)) + { + MYSQL_YYABORT; + } + } + ; /********************************************************************** ** Creating different items. @@ -7904,6 +8897,8 @@ table_wild: { SELECT_LEX *sel= Select; $$ = new Item_field(Lex->current_context(), NullS, $1.str, "*"); + if ($$ == NULL) + MYSQL_YYABORT; sel->with_wild++; } | ident '.' ident '.' '*' @@ -7912,6 +8907,8 @@ table_wild: $$ = new Item_field(Lex->current_context(), (YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS : $1.str), $3.str,"*"); + if ($$ == NULL) + MYSQL_YYABORT; sel->with_wild++; } ; @@ -7941,11 +8938,12 @@ simple_ident: lip->tok_start_prev - lex->sphead->m_tmp_query, lip->tok_end - lip->tok_start_prev); + if (splocal == NULL) + MYSQL_YYABORT; #ifndef DBUG_OFF - if (splocal) - splocal->m_sp= lex->sphead; + splocal->m_sp= lex->sphead; #endif - $$ = (Item*) splocal; + $$= splocal; lex->safe_to_cache_query=0; } else @@ -7955,6 +8953,8 @@ simple_ident: sel->get_in_sum_expr() > 0) ? (Item*) new Item_field(Lex->current_context(), NullS, NullS, $1.str) : (Item*) new Item_ref(Lex->current_context(), NullS, NullS, $1.str); + if ($$ == NULL) + MYSQL_YYABORT; } } | simple_ident_q { $$= $1; } @@ -7968,6 +8968,8 @@ simple_ident_nospvar: sel->get_in_sum_expr() > 0) ? (Item*) new Item_field(Lex->current_context(), NullS, NullS, $1.str) : (Item*) new Item_ref(Lex->current_context(), NullS, NullS, $1.str); + if ($$ == NULL) + MYSQL_YYABORT; } | simple_ident_q { $$= $1; } ; @@ -8039,6 +9041,8 @@ simple_ident_q: sel->get_in_sum_expr() > 0) ? (Item*) new Item_field(Lex->current_context(), NullS, $1.str, $3.str) : (Item*) new Item_ref(Lex->current_context(), NullS, $1.str, $3.str); + if ($$ == NULL) + MYSQL_YYABORT; } } | '.' ident '.' ident @@ -8055,6 +9059,8 @@ simple_ident_q: sel->get_in_sum_expr() > 0) ? (Item*) new Item_field(Lex->current_context(), NullS, $2.str, $4.str) : (Item*) new Item_ref(Lex->current_context(), NullS, $2.str, $4.str); + if ($$ == NULL) + MYSQL_YYABORT; } | ident '.' ident '.' ident { @@ -8076,6 +9082,8 @@ simple_ident_q: (YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS : $1.str), $3.str, $5.str); + if ($$ == NULL) + MYSQL_YYABORT; }; @@ -8110,13 +9118,34 @@ field_ident: | '.' ident { $$=$2;} /* For Delphi */; table_ident: - ident { $$=new Table_ident($1); } - | ident '.' ident { $$=new Table_ident(YYTHD, $1,$3,0);} - | '.' ident { $$=new Table_ident($2);} /* For Delphi */ + ident + { + $$=new Table_ident($1); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ident '.' ident + { + $$=new Table_ident(YYTHD, $1,$3,0); + if ($$ == NULL) + MYSQL_YYABORT; + } + | '.' ident + { + $$=new Table_ident($2); /* For Delphi */ + if ($$ == NULL) + MYSQL_YYABORT; + } ; table_ident_nodb: - ident { LEX_STRING db={(char*) any_db,3}; $$=new Table_ident(YYTHD, db,$1,0); } + ident + { + LEX_STRING db={(char*) any_db,3}; + $$=new Table_ident(YYTHD, db,$1,0); + if ($$ == NULL) + MYSQL_YYABORT; + } ; IDENT_sys: @@ -8140,8 +9169,11 @@ IDENT_sys: $$= $1; } else - thd->convert_string(&$$, system_charset_info, - $1.str, $1.length, thd->charset()); + { + if (thd->convert_string(&$$, system_charset_info, + $1.str, $1.length, thd->charset())) + MYSQL_YYABORT; + } } ; @@ -8152,8 +9184,11 @@ TEXT_STRING_sys: if (thd->charset_is_system_charset) $$= $1; else - thd->convert_string(&$$, system_charset_info, - $1.str, $1.length, thd->charset()); + { + if (thd->convert_string(&$$, system_charset_info, + $1.str, $1.length, thd->charset())) + MYSQL_YYABORT; + } } ; @@ -8164,8 +9199,11 @@ TEXT_STRING_literal: if (thd->charset_is_collation_connection) $$= $1; else - thd->convert_string(&$$, thd->variables.collation_connection, - $1.str, $1.length, thd->charset()); + { + if (thd->convert_string(&$$, thd->variables.collation_connection, + $1.str, $1.length, thd->charset())) + MYSQL_YYABORT; + } } ; @@ -8177,8 +9215,11 @@ TEXT_STRING_filesystem: if (thd->charset_is_character_set_filesystem) $$= $1; else - thd->convert_string(&$$, thd->variables.character_set_filesystem, - $1.str, $1.length, thd->charset()); + { + if (thd->convert_string(&$$, thd->variables.character_set_filesystem, + $1.str, $1.length, thd->charset())) + MYSQL_YYABORT; + } } ; @@ -8188,6 +9229,8 @@ ident: { THD *thd= YYTHD; $$.str= thd->strmake($1.str, $1.length); + if ($$.str == NULL) + MYSQL_YYABORT; $$.length= $1.length; } ; @@ -8198,6 +9241,8 @@ label_ident: { THD *thd= YYTHD; $$.str= thd->strmake($1.str, $1.length); + if ($$.str == NULL) + MYSQL_YYABORT; $$.length= $1.length; } ; @@ -8729,29 +9774,50 @@ sys_option_value: LEX *lex=Lex; if ($1) lex->option_type= $1; - lex->var_list.push_back(new set_var(lex->option_type, - find_sys_var("tx_isolation"), - &null_lex_str, - new Item_int((int32) $5))); + Item *item= new Item_int((int32) $5); + if (item == NULL) + MYSQL_YYABORT; + set_var *var= new set_var(lex->option_type, + find_sys_var("tx_isolation"), + &null_lex_str, + item); + if (var == NULL) + MYSQL_YYABORT; + lex->var_list.push_back(var); } ; option_value: '@' ident_or_text equal expr { - Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4))); + Item_func_set_user_var *item= new Item_func_set_user_var($2,$4); + if (item == NULL) + MYSQL_YYABORT; + set_var_user *var= new set_var_user(item); + if (var == NULL) + MYSQL_YYABORT; + Lex->var_list.push_back(var); } | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default { LEX *lex=Lex; - lex->var_list.push_back(new set_var($3, $4.var, &$4.base_name, $6)); + set_var *var= new set_var($3, $4.var, &$4.base_name, $6); + if (var == NULL) + MYSQL_YYABORT; + lex->var_list.push_back(var); } | charset old_or_new_charset_name_or_default { THD *thd= YYTHD; LEX *lex= Lex; $2= $2 ? $2: global_system_variables.character_set_client; - lex->var_list.push_back(new set_var_collation_client($2,thd->variables.collation_database,$2)); + set_var_collation_client *var; + var= new set_var_collation_client($2, + thd->variables.collation_database, + $2); + if (var == NULL) + MYSQL_YYABORT; + lex->var_list.push_back(var); } | NAMES_SYM equal expr { @@ -8779,7 +9845,11 @@ option_value: $3->name, $2->csname); MYSQL_YYABORT; } - lex->var_list.push_back(new set_var_collation_client($3,$3,$3)); + set_var_collation_client *var; + var= new set_var_collation_client($3,$3,$3); + if (var == NULL) + MYSQL_YYABORT; + lex->var_list.push_back(var); } | PASSWORD equal text_or_password { @@ -8800,11 +9870,17 @@ option_value: MYSQL_YYABORT; user->host=null_lex_str; user->user.str=thd->security_ctx->priv_user; - thd->lex->var_list.push_back(new set_var_password(user, $3)); + set_var_password *var= new set_var_password(user, $3); + if (var == NULL) + MYSQL_YYABORT; + thd->lex->var_list.push_back(var); } | PASSWORD FOR_SYM user equal text_or_password { - Lex->var_list.push_back(new set_var_password($3,$5)); + set_var_password *var= new set_var_password($3,$5); + if (var == NULL) + MYSQL_YYABORT; + Lex->var_list.push_back(var); } ; @@ -8918,11 +9994,15 @@ text_or_password: Item_func_old_password::alloc(YYTHD, $3.str) : Item_func_password::alloc(YYTHD, $3.str) : $3.str; + if ($$ == NULL) + MYSQL_YYABORT; } | OLD_PASSWORD '(' TEXT_STRING ')' { $$= $3.length ? Item_func_old_password::alloc(YYTHD, $3.str) : $3.str; + if ($$ == NULL) + MYSQL_YYABORT; } ; @@ -8930,9 +10010,24 @@ text_or_password: set_expr_or_default: expr { $$=$1; } | DEFAULT { $$=0; } - | ON { $$=new Item_string("ON", 2, system_charset_info); } - | ALL { $$=new Item_string("ALL", 3, system_charset_info); } - | BINARY { $$=new Item_string("binary", 6, system_charset_info); } + | ON + { + $$=new Item_string("ON", 2, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } + | ALL + { + $$=new Item_string("ALL", 3, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } + | BINARY + { + $$=new Item_string("binary", 6, system_charset_info); + if ($$ == NULL) + MYSQL_YYABORT; + } ; @@ -9033,7 +10128,10 @@ handler: } lex->sql_command = SQLCOM_HA_READ; lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */ - lex->current_select->select_limit= new Item_int((int32) 1); + Item *one= new Item_int((int32) 1); + if (one == NULL) + MYSQL_YYABORT; + lex->current_select->select_limit= one; lex->current_select->offset_limit= 0; if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0)) MYSQL_YYABORT; @@ -9340,8 +10438,9 @@ grant_user: { char *buff= (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1); - if (buff) - make_scrambled_password_323(buff, $4.str); + if (buff == NULL) + MYSQL_YYABORT; + make_scrambled_password_323(buff, $4.str); $1->password.str= buff; $1->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323; } @@ -9349,8 +10448,9 @@ grant_user: { char *buff= (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1); - if (buff) - make_scrambled_password(buff, $4.str); + if (buff == NULL) + MYSQL_YYABORT; + make_scrambled_password(buff, $4.str); $1->password.str= buff; $1->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH; } @@ -9379,6 +10479,8 @@ column_list_id: ident { String *new_str = new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); + if (new_str == NULL) + MYSQL_YYABORT; List_iterator iter(Lex->columns); class LEX_COLUMN *point; LEX *lex=Lex; @@ -9392,7 +10494,12 @@ column_list_id: if (point) point->rights |= lex->which_columns; else - lex->columns.push_back(new LEX_COLUMN (*new_str,lex->which_columns)); + { + LEX_COLUMN *col= new LEX_COLUMN (*new_str,lex->which_columns); + if (col == NULL) + MYSQL_YYABORT; + lex->columns.push_back(col); + } } ; @@ -9806,13 +10913,17 @@ view_list_opt: view_list: ident { - Lex->view_list.push_back((LEX_STRING*) - sql_memdup(&$1, sizeof(LEX_STRING))); + LEX_STRING *ls= (LEX_STRING*) sql_memdup(&$1, sizeof(LEX_STRING)); + if (ls == NULL) + MYSQL_YYABORT; + Lex->view_list.push_back(ls); } | view_list ',' ident { - Lex->view_list.push_back((LEX_STRING*) - sql_memdup(&$3, sizeof(LEX_STRING))); + LEX_STRING *ls= (LEX_STRING*) sql_memdup(&$3, sizeof(LEX_STRING)); + if (ls == NULL) + MYSQL_YYABORT; + Lex->view_list.push_back(ls); } ; @@ -9985,6 +11096,8 @@ sf_tail: /* Order is important here: new - reset - init */ sp= new sp_head(); + if (sp == NULL) + MYSQL_YYABORT; sp->reset_thd_mem_root(thd); sp->init(lex); sp->init_sp_name(thd, lex->spname); diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc index 392db9224c3..4ebcf1c50af 100644 --- a/sql/thr_malloc.cc +++ b/sql/thr_malloc.cc @@ -21,10 +21,35 @@ extern "C" { void sql_alloc_error_handler(void) { - THD *thd=current_thd; - if (thd) // QQ; To be removed - thd->fatal_error(); /* purecov: inspected */ sql_print_error(ER(ER_OUT_OF_RESOURCES)); + + THD *thd=current_thd; + if (thd) + { + /* + This thread is Out Of Memory. + An OOM condition is a fatal error. + It should not be caught by error handlers in stored procedures. + Also, recording that SQL condition in the condition area could + cause more memory allocations, which in turn could raise more + OOM conditions, causing recursion in the error handling code itself. + As a result, my_error() should not be invoked, and the + thread diagnostics area is set to an error status directly. + The visible result for a client application will be: + - a query fails with an ER_OUT_OF_RESOURCES error, + returned in the error packet. + - SHOW ERROR/SHOW WARNINGS may be empty. + */ + + NET *net= &thd->net; + thd->fatal_error(); + if (!net->last_error[0]) // Return only first message + { + strmake(net->last_error, ER(ER_OUT_OF_RESOURCES), + sizeof(net->last_error)-1); + net->last_errno= ER_OUT_OF_RESOURCES; + } + } } } -- cgit v1.2.1 From 2b7ba54cb62bdfe9f8e9ad01d5c9ed55e378c1e5 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 23 Oct 2008 19:39:56 +0200 Subject: Merge fixes for bug#32167 and bug#37428 into 5.0.66sp1 --- include/my_sys.h | 1 + include/myisam.h | 4 ++++ myisam/mi_check.c | 6 ++--- myisam/mi_open.c | 42 +++++++++++++++++++++++++++------- myisam/mi_static.c | 9 ++++++++ myisam/myisamchk.c | 2 +- myisam/myisamdef.h | 4 +++- mysql-test/r/symlink.result | 2 -- mysql-test/r/udf.result | 6 +++++ mysql-test/t/symlink.test | 8 +++---- mysys/my_symlink.c | 55 ++++++++++++++++++++++++++------------------- mysys/thr_lock.c | 2 +- sql/mysql_priv.h | 6 +++++ sql/mysqld.cc | 22 +++++++++++++++--- sql/set_var.cc | 1 + sql/sql_parse.cc | 33 ++++++++++++++++----------- sql/sql_udf.cc | 26 ++++++++++++++++++--- sql/unireg.h | 3 +++ 18 files changed, 170 insertions(+), 62 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index db01223602d..5dc73bf84d9 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -574,6 +574,7 @@ extern int my_close(File Filedes,myf MyFlags); extern File my_dup(File file, myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); extern int my_readlink(char *to, const char *filename, myf MyFlags); +extern int my_is_symlink(const char *filename); extern int my_realpath(char *to, const char *filename, myf MyFlags); extern File my_create_with_symlink(const char *linkname, const char *filename, int createflags, int access_flags, diff --git a/include/myisam.h b/include/myisam.h index 61b9f39e63b..ad585f79608 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -267,6 +267,10 @@ extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user; extern my_off_t myisam_max_temp_length; extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size; +/* usually used to check if a symlink points into the mysql data home */ +/* which is normally forbidden */ +extern int (*myisam_test_invalid_symlink)(const char *filename); + /* Prototypes for myisam-functions */ extern int mi_close(struct st_myisam_info *file); diff --git a/myisam/mi_check.c b/myisam/mi_check.c index daa5886f3ba..4f8883f377e 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1732,7 +1732,7 @@ err: DATA_TMP_EXT, share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || - mi_open_datafile(info,share,-1)) + mi_open_datafile(info,share,name,-1)) got_error=1; } } @@ -2519,7 +2519,7 @@ err: DATA_TMP_EXT, share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || - mi_open_datafile(info,share,-1)) + mi_open_datafile(info,share,name,-1)) got_error=1; } } @@ -3050,7 +3050,7 @@ err: DATA_TMP_EXT, share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || - mi_open_datafile(info,share,-1)) + mi_open_datafile(info,share,name,-1)) got_error=1; } } diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 6865708a941..8e2f61a3b4b 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -74,7 +74,7 @@ MI_INFO *test_if_reopen(char *filename) MI_INFO *mi_open(const char *name, int mode, uint open_flags) { - int lock_error,kfile,open_mode,save_errno,have_rtree=0; + int lock_error,kfile,open_mode,save_errno,have_rtree=0, realpath_err; uint i,j,len,errpos,head_length,base_pos,offset,info_length,keys, key_parts,unique_key_parts,fulltext_keys,uniques; char name_buff[FN_REFLEN], org_name[FN_REFLEN], index_name[FN_REFLEN], @@ -94,7 +94,16 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) head_length=sizeof(share_buff.state.header); bzero((byte*) &info,sizeof(info)); - my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0)); + realpath_err= my_realpath(name_buff, + fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0)); + if (my_is_symlink(org_name) && + (realpath_err || (*myisam_test_invalid_symlink)(name_buff))) + { + my_errno= HA_WRONG_CREATE_OPTION; + DBUG_RETURN (NULL); + } + + pthread_mutex_lock(&THR_LOCK_myisam); if (!(old_info=test_if_reopen(name_buff))) { @@ -463,7 +472,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) lock_error=1; /* Database unlocked */ } - if (mi_open_datafile(&info, share, -1)) + if (mi_open_datafile(&info, share, name, -1)) goto err; errpos=5; @@ -534,7 +543,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) my_errno=EACCES; /* Can't open in write mode */ goto err; } - if (mi_open_datafile(&info, share, old_info->dfile)) + if (mi_open_datafile(&info, share, name, old_info->dfile)) goto err; errpos=5; have_rtree= old_info->rtree_recursion_state != NULL; @@ -1191,12 +1200,30 @@ The argument file_to_dup is here for the future if there would on some OS exist a dup()-like call that would give us two different file descriptors. *************************************************************************/ -int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup __attribute__((unused))) +int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *org_name, + File file_to_dup __attribute__((unused))) { + char *data_name= share->data_file_name; + char real_data_name[FN_REFLEN]; + + if (org_name) + { + fn_format(real_data_name,org_name,"",MI_NAME_DEXT,4); + if (my_is_symlink(real_data_name)) + { + if (my_realpath(real_data_name, real_data_name, MYF(0)) || + (*myisam_test_invalid_symlink)(real_data_name)) + { + my_errno= HA_WRONG_CREATE_OPTION; + return 1; + } + data_name= real_data_name; + } + } #ifdef USE_RAID if (share->base.raid_type) { - info->dfile=my_raid_open(share->data_file_name, + info->dfile=my_raid_open(data_name, share->mode | O_SHARE, share->base.raid_type, share->base.raid_chunks, @@ -1205,8 +1232,7 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup __attr } else #endif - info->dfile=my_open(share->data_file_name, share->mode | O_SHARE, - MYF(MY_WME)); + info->dfile=my_open(data_name, share->mode | O_SHARE, MYF(MY_WME)); return info->dfile >= 0 ? 0 : 1; } diff --git a/myisam/mi_static.c b/myisam/mi_static.c index 21a25f66b7c..ab7d3dc592b 100644 --- a/myisam/mi_static.c +++ b/myisam/mi_static.c @@ -41,6 +41,15 @@ my_off_t myisam_max_temp_length= MAX_FILE_SIZE; ulong myisam_bulk_insert_tree_size=8192*1024; ulong myisam_data_pointer_size=4; + +static int always_valid(const char *filename __attribute__((unused))) +{ + return 0; +} + +int (*myisam_test_invalid_symlink)(const char *filename)= always_valid; + + /* read_vec[] is used for converting between P_READ_KEY.. and SEARCH_ Position is , == , >= , <= , > , < diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index d421bbc92ed..29fb2ea1a60 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -1039,7 +1039,7 @@ static int myisamchk(MI_CHECK *param, my_string filename) error|=change_to_newfile(filename,MI_NAME_DEXT,DATA_TMP_EXT, raid_chunks, MYF(0)); - if (mi_open_datafile(info,info->s, -1)) + if (mi_open_datafile(info,info->s, NULL, -1)) error=1; param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */ param->read_cache.file=info->dfile; diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index 1a04cbe74fc..4ebd5648d26 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -739,7 +739,9 @@ void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); extern MI_INFO *test_if_reopen(char *filename); my_bool check_table_is_closed(const char *name, const char *where); -int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup); +int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *orn_name, + File file_to_dup); + int mi_open_keyfile(MYISAM_SHARE *share); void mi_setup_functions(register MYISAM_SHARE *share); diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 689aa724935..47901a5d896 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -57,8 +57,6 @@ t9 CREATE TABLE `t9` ( Got one of the listed errors Got one of the listed errors Got one of the listed errors -Got one of the listed errors -Got one of the listed errors alter table t9 rename mysqltest.t9; select count(*) from mysqltest.t9; count(*) diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index a79be1c3189..92185962d1f 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -1,5 +1,7 @@ drop table if exists t1; CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +Warnings: +Warning 1105 plugin_dir was not specified CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; ERROR HY000: Can't find function 'myfunc_nonexist' in library @@ -197,6 +199,8 @@ DROP FUNCTION avgcost; select * from mysql.func; name ret dl type CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +Warnings: +Warning 1105 plugin_dir was not specified select IS_const(3); IS_const(3) const @@ -206,6 +210,8 @@ name ret dl type select is_const(3); ERROR 42000: FUNCTION test.is_const does not exist CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB"; +Warnings: +Warning 1105 plugin_dir was not specified select is_const(3) as const, is_const(3.14) as const, diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 10d8f355c98..9478abe1224 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -71,8 +71,6 @@ drop table t1; SHOW CREATE TABLE t9; disable_query_log; ---error 1103,1103 -create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp"; # Check that we cannot link over a table from another database. @@ -81,8 +79,9 @@ create database mysqltest; --error 1,1 create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist"; ---error 1103,1103 -create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path"; +# temporarily disabled as it returns different result in the embedded server +# --error 1210, 1210 +# create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path"; # Should fail becasue the file t9.MYI already exist in 'run' --error 1,1,1105 @@ -230,6 +229,7 @@ SET SESSION keep_files_on_create = TRUE; EOF --disable_abort_on_error --error 1 +--replace_result $MYSQLTEST_VARDIR . master-data/ '' CREATE TABLE t1 (a INT) ENGINE MYISAM; --error 0,1 --remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD; diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c index 810c0c72632..7f2be5644e8 100644 --- a/mysys/my_symlink.c +++ b/mysys/my_symlink.c @@ -106,38 +106,47 @@ int my_symlink(const char *content, const char *linkname, myf MyFlags) #define BUFF_LEN FN_LEN #endif + +int my_is_symlink(const char *filename __attribute__((unused))) +{ +#if defined (HAVE_LSTAT) && defined (S_ISLNK) + struct stat stat_buff; + return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode); +#elif defined (_WIN32) + DWORD dwAttr = GetFileAttributes(filename); + return (dwAttr != INVALID_FILE_ATTRIBUTES) && + (dwAttr & FILE_ATTRIBUTE_REPARSE_POINT); +#else /* No symlinks */ + return 0; +#endif +} + + int my_realpath(char *to, const char *filename, myf MyFlags __attribute__((unused))) { #if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH) int result=0; char buff[BUFF_LEN]; - struct stat stat_buff; + char *ptr; DBUG_ENTER("my_realpath"); - if (!(MyFlags & MY_RESOLVE_LINK) || - (!lstat(filename,&stat_buff) && S_ISLNK(stat_buff.st_mode))) - { - char *ptr; - DBUG_PRINT("info",("executing realpath")); - if ((ptr=realpath(filename,buff))) - { + DBUG_PRINT("info",("executing realpath")); + if ((ptr=realpath(filename,buff))) strmake(to,ptr,FN_REFLEN-1); - } - else - { - /* - Realpath didn't work; Use my_load_path() which is a poor substitute - original name but will at least be able to resolve paths that starts - with '.'. - */ - DBUG_PRINT("error",("realpath failed with errno: %d", errno)); - my_errno=errno; - if (MyFlags & MY_WME) - my_error(EE_REALPATH, MYF(0), filename, my_errno); - my_load_path(to, filename, NullS); - result= -1; - } + else + { + /* + Realpath didn't work; Use my_load_path() which is a poor substitute + original name but will at least be able to resolve paths that starts + with '.'. + */ + DBUG_PRINT("error",("realpath failed with errno: %d", errno)); + my_errno=errno; + if (MyFlags & MY_WME) + my_error(EE_REALPATH, MYF(0), filename, my_errno); + my_load_path(to, filename, NullS); + result= -1; } DBUG_RETURN(result); #else diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 02c9f08c946..853e1f96b49 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -333,10 +333,10 @@ void thr_lock_init(THR_LOCK *lock) void thr_lock_delete(THR_LOCK *lock) { DBUG_ENTER("thr_lock_delete"); - VOID(pthread_mutex_destroy(&lock->mutex)); pthread_mutex_lock(&THR_LOCK_lock); thr_lock_thread_list=list_delete(thr_lock_thread_list,&lock->list); pthread_mutex_unlock(&THR_LOCK_lock); + pthread_mutex_destroy(&lock->mutex); DBUG_VOID_RETURN; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 607c06f55d2..cc82e60fc62 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1264,6 +1264,7 @@ extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH], mysql_real_data_home[], *opt_mysql_tmpdir, mysql_charsets_dir[], mysql_unpacked_real_data_home[], def_ft_boolean_syntax[sizeof(ft_boolean_syntax)]; +extern int mysql_unpacked_real_data_home_len; #define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list)) extern MY_TMPDIR mysql_tmpdir_list; extern const char *command_name[]; @@ -1342,6 +1343,9 @@ extern char *default_tz_name; extern my_bool opt_large_pages; extern uint opt_large_page_size; +extern char *opt_plugin_dir_ptr; +extern char opt_plugin_dir[FN_REFLEN]; + extern MYSQL_LOG mysql_log,mysql_slow_log,mysql_bin_log; extern FILE *bootstrap_file; extern int bootstrap_error; @@ -1764,6 +1768,8 @@ inline void kill_delayed_threads(void) {} #define check_stack_overrun(A, B, C) 0 #endif +extern "C" int test_if_data_home_dir(const char *dir); + #endif /* MYSQL_CLIENT */ #endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index cdae94f0a61..757427f9fdf 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -324,6 +324,9 @@ arg_cmp_func Arg_comparator::comparator_matrix[5][2] = /* static variables */ +char opt_plugin_dir[FN_REFLEN]; +char *opt_plugin_dir_ptr; + static bool lower_case_table_names_used= 0; static bool volatile select_thread_in_use, signal_thread_in_use; static bool volatile ready_to_exit; @@ -477,6 +480,7 @@ char mysql_real_data_home[FN_REFLEN], *opt_init_file, *opt_tc_log_file, mysql_unpacked_real_data_home[FN_REFLEN], def_ft_boolean_syntax[sizeof(ft_boolean_syntax)]; +int mysql_unpacked_real_data_home_len; char *mysql_data_home= mysql_real_data_home; const key_map key_map_empty(0); key_map key_map_full(0); // Will be initialized later @@ -4984,6 +4988,7 @@ enum options_mysqld OPT_OLD_STYLE_USER_LIMITS, OPT_LOG_SLOW_ADMIN_STATEMENTS, OPT_TABLE_LOCK_WAIT_TIMEOUT, + OPT_PLUGIN_DIR, OPT_PORT_OPEN_TIMEOUT, OPT_MERGE, OPT_INNODB_ROLLBACK_ON_TIMEOUT, @@ -6216,6 +6221,10 @@ The minimum value for this variable is 4096.", (gptr*) &global_system_variables.optimizer_search_depth, (gptr*) &max_system_variables.optimizer_search_depth, 0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0}, + {"plugin_dir", OPT_PLUGIN_DIR, + "Directory for plugins.", + (gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE, "The size of the buffer that is allocated when preloading indexes", (gptr*) &global_system_variables.preload_buff_size, @@ -6696,6 +6705,7 @@ static void mysql_init_variables(void) /* Things reset to zero */ opt_skip_slave_start= opt_reckless_slave = 0; mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0; + myisam_test_invalid_symlink= test_if_data_home_dir; opt_log= opt_slow_log= 0; opt_update_log= 0; opt_bin_log= 0; @@ -7746,13 +7756,19 @@ static void fix_paths(void) pos[1]= 0; } convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS); - (void) fn_format(buff, mysql_real_data_home, "", "", - (MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS)); - (void) unpack_dirname(mysql_unpacked_real_data_home, buff); + my_realpath(mysql_unpacked_real_data_home, mysql_real_data_home, MYF(0)); + mysql_unpacked_real_data_home_len= strlen(mysql_unpacked_real_data_home); + if (mysql_unpacked_real_data_home[mysql_unpacked_real_data_home_len-1] == FN_LIBCHAR) + --mysql_unpacked_real_data_home_len; + + convert_dirname(language,language,NullS); (void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home); (void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home); + (void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr : + "", ""); + opt_plugin_dir_ptr= opt_plugin_dir; char *sharedir=get_relative_path(SHAREDIR); if (test_if_hard_path(sharedir)) diff --git a/sql/set_var.cc b/sql/set_var.cc index 84766e511ca..6bc19f2e6eb 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1026,6 +1026,7 @@ struct show_var_st init_vars[]= { {sys_optimizer_search_depth.name,(char*) &sys_optimizer_search_depth, SHOW_SYS}, {"pid_file", (char*) pidfile_name, SHOW_CHAR}, + {"plugin_dir", (char*) opt_plugin_dir, SHOW_CHAR}, {"port", (char*) &mysqld_port, SHOW_INT}, {sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS}, {"protocol_version", (char*) &protocol_version, SHOW_INT}, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 62a5a79a833..d9339437f50 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -76,7 +76,6 @@ static void remove_escape(char *name); static bool append_file_to_dir(THD *thd, const char **filename_ptr, const char *table_name); static bool check_show_create_table_access(THD *thd, TABLE_LIST *table); -static bool test_if_data_home_dir(const char *dir); const char *any_db="*any*"; // Special symbol for check_access @@ -3044,13 +3043,13 @@ mysql_execute_command(THD *thd) if (test_if_data_home_dir(lex->create_info.data_file_name)) { - my_error(ER_WRONG_ARGUMENTS,MYF(0),"DATA DIRECORY"); + my_error(ER_WRONG_ARGUMENTS,MYF(0),"DATA DIRECTORY"); res= -1; break; } if (test_if_data_home_dir(lex->create_info.index_file_name)) { - my_error(ER_WRONG_ARGUMENTS,MYF(0),"INDEX DIRECORY"); + my_error(ER_WRONG_ARGUMENTS,MYF(0),"INDEX DIRECTORY"); res= -1; break; } @@ -7919,10 +7918,12 @@ bool check_string_length(LEX_STRING *str, const char *err_msg, 1 error */ -static bool test_if_data_home_dir(const char *dir) +C_MODE_START + +int test_if_data_home_dir(const char *dir) { - char path[FN_REFLEN], conv_path[FN_REFLEN]; - uint dir_len, home_dir_len= strlen(mysql_unpacked_real_data_home); + char path[FN_REFLEN]; + int dir_len; DBUG_ENTER("test_if_data_home_dir"); if (!dir) @@ -7930,21 +7931,27 @@ static bool test_if_data_home_dir(const char *dir) (void) fn_format(path, dir, "", "", (MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS)); - dir_len= unpack_dirname(conv_path, dir); - - if (home_dir_len <= dir_len) + dir_len= strlen(path); + if (mysql_unpacked_real_data_home_len<= dir_len) { + if (dir_len > mysql_unpacked_real_data_home_len && + path[mysql_unpacked_real_data_home_len] != FN_LIBCHAR) + DBUG_RETURN(0); + if (lower_case_file_system) { - if (!my_strnncoll(default_charset_info, (const uchar*) conv_path, - home_dir_len, + if (!my_strnncoll(default_charset_info, (const uchar*) path, + mysql_unpacked_real_data_home_len, (const uchar*) mysql_unpacked_real_data_home, - home_dir_len)) + mysql_unpacked_real_data_home_len)) DBUG_RETURN(1); } - else if (!memcmp(conv_path, mysql_unpacked_real_data_home, home_dir_len)) + else if (!memcmp(path, mysql_unpacked_real_data_home, + mysql_unpacked_real_data_home_len)) DBUG_RETURN(1); } DBUG_RETURN(0); } +C_MODE_END + diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 34ca18d5c39..e3a0230d2fb 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -214,7 +214,17 @@ void udf_init() void *dl = find_udf_dl(tmp->dl); if (dl == NULL) { - if (!(dl = dlopen(tmp->dl, RTLD_NOW))) + char dlpath[FN_REFLEN]; + if (*opt_plugin_dir) + strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", tmp->dl, + NullS); + else + { + strxnmov(dlpath, sizeof(dlpath)-1, tmp->dl, NullS); + push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, + "plugin_dir was not specified"); + } + if (!(dl = dlopen(dlpath, RTLD_NOW))) { /* Print warning to log */ sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl,errno,dlerror()); @@ -443,8 +453,18 @@ int mysql_create_function(THD *thd,udf_func *udf) } if (!(dl = find_udf_dl(udf->dl))) { - DBUG_PRINT("info", ("Calling dlopen, udf->dl: %s", udf->dl)); - if (!(dl = dlopen(udf->dl, RTLD_NOW))) + char dlpath[FN_REFLEN]; + if (*opt_plugin_dir) + strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", udf->dl, + NullS); + else + { + strxnmov(dlpath, sizeof(dlpath)-1, udf->dl, NullS); + push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, + "plugin_dir was not specified"); + } + DBUG_PRINT("info", ("Calling dlopen, udf->dl: %s", dlpath)); + if (!(dl = dlopen(dlpath, RTLD_NOW))) { DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)", udf->dl,errno,dlerror())); diff --git a/sql/unireg.h b/sql/unireg.h index 1326b22c8c9..8e01e6222e6 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -35,6 +35,9 @@ #ifndef SHAREDIR #define SHAREDIR "share/" #endif +#ifndef PLUGINDIR +#define PLUGINDIR "lib/plugin" +#endif #define ER(X) errmesg[(X) - ER_ERROR_FIRST] #define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code") -- cgit v1.2.1 From 0fb0db53d60ffaa121d432e51feec1a94eb69682 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 23 Oct 2008 21:46:46 +0200 Subject: Revert part of last change, it was not related to a security fix. --- mysys/thr_lock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 853e1f96b49..02c9f08c946 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -333,10 +333,10 @@ void thr_lock_init(THR_LOCK *lock) void thr_lock_delete(THR_LOCK *lock) { DBUG_ENTER("thr_lock_delete"); + VOID(pthread_mutex_destroy(&lock->mutex)); pthread_mutex_lock(&THR_LOCK_lock); thr_lock_thread_list=list_delete(thr_lock_thread_list,&lock->list); pthread_mutex_unlock(&THR_LOCK_lock); - pthread_mutex_destroy(&lock->mutex); DBUG_VOID_RETURN; } -- cgit v1.2.1 From 2f08a0798d935ccd93e4bc2ee34dd60e0c9c3c0f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 6 Nov 2008 19:38:19 +0100 Subject: Back merges from 6.0.8 - Removed some copy/paste between debug and normal build in RPM spec - Removed "mysql_upgrade_shell" from RPM build - Removed use of "grep -q" in "configure.in", not portable - Improved test to disable ABI check not to accidently run for icc Other changes - Added make file test targets 'test-bt-fast' and 'test-bt-debug-fast' - Reenabled "jp" test suite run --- Makefile.am | 21 +++++++++++++--- config/ac-macros/ha_ndbcluster.m4 | 2 +- configure.in | 8 +++--- support-files/mysql.spec.sh | 51 ++++++++++++++++++--------------------- 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/Makefile.am b/Makefile.am index c0a5334a032..26670c42305 100644 --- a/Makefile.am +++ b/Makefile.am @@ -159,6 +159,8 @@ test-bt: @PERL@ ./mysql-test-run.pl --force --comment=partitions --suite=parts -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp -if [ -d mysql-test/suite/nist ] ; then \ cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=nist --force --suite=nist ; \ @@ -175,15 +177,28 @@ test-bt: echo "no program found for 'embedded' tests - skipped testing" ; \ fi -# Re-enable the "jp" suite when bug#28563 is fixed -# -cd mysql-test ; MTR_BUILD_THREAD=auto \ -# @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp +test-bt-fast: + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=ps --force --timer \ + --skip-ndbcluster --ps-protocol + -if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \ + cd mysql-test ; \ + MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --comment=ndb --force --timer \ + --with-ndbcluster-only ; \ + else \ + echo "no program found for 'ndbcluster' tests - skipped testing" ; \ + fi + -cd mysql-test ; MTR_BUILD_THREAD=auto \ + @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress test-bt-debug: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=debug --force --timer \ --skip-ndbcluster --skip-rpl --report-features +test-bt-debug-fast: + # Keep these for a while test-pl: test test-full-pl: test-full diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index 9df96a7750b..5ee136f2266 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -280,7 +280,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ esac # libndbclient versioning when linked with GNU ld. - if $LD --version 2>/dev/null|grep -q GNU; then + if $LD --version 2>/dev/null|grep GNU >/dev/null 2>&1 ; then NDB_LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/storage/ndb/src/libndb.ver" AC_CONFIG_FILES(storage/ndb/src/libndb.ver) fi diff --git a/configure.in b/configure.in index 63ab547f70d..c57c1efee9f 100644 --- a/configure.in +++ b/configure.in @@ -377,7 +377,7 @@ fi MYSQL_PROG_AR # libmysqlclient versioning when linked with GNU ld. -if $LD --version 2>/dev/null|grep -q GNU; then +if $LD --version 2>/dev/null| grep GNU >/dev/null 2>&1; then LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver" AC_CONFIG_FILES(libmysql/libmysql.ver) fi @@ -449,11 +449,11 @@ AC_SUBST(PERL5) # Enable the abi_check rule only if gcc is available -if expr "$CC" : ".*gcc.*" +if test "$GCC" != "yes" || expr "$CC" : ".*icc.*" then - ABI_CHECK="abi_check" -else ABI_CHECK="" +else + ABI_CHECK="abi_check" fi AC_SUBST(ABI_CHECK) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index e7c090484b7..812b5958b91 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -279,7 +279,20 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --mandir=%{_mandir} \ --enable-thread-safe-client \ --with-readline \ - " + --with-innodb \ +%if %{CLUSTER_BUILD} + --with-ndbcluster \ +%else + --without-ndbcluster \ +%endif + --with-archive-storage-engine \ + --with-csv-storage-engine \ + --with-blackhole-storage-engine \ + --with-federated-storage-engine \ + --with-partition \ + --with-big-tables \ + --enable-shared \ + " make } @@ -306,6 +319,8 @@ mkdir -p $RBR%{_libdir}/mysql PATH=${MYSQL_BUILD_PATH:-/bin:/usr/bin} export PATH +# Build the Debug binary. + # Use gcc for C and C++ code (to avoid a dependency on libstdc++ and # including exceptions into the code if [ -z "$CXX" -a -z "$CC" ] @@ -333,20 +348,8 @@ CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip / cd mysql-debug-%{mysql_version} && CFLAGS=\"$CFLAGS\" \ CXXFLAGS=\"$CXXFLAGS\" \ -BuildMySQL "--enable-shared \ +BuildMySQL "\ --with-debug \ - --with-innodb \ -%if %{CLUSTER_BUILD} - --with-ndbcluster \ -%else - --without-ndbcluster \ -%endif - --with-archive-storage-engine \ - --with-csv-storage-engine \ - --with-blackhole-storage-engine \ - --with-federated-storage-engine \ - --with-partition \ - --with-big-tables \ --with-comment=\"MySQL Community Server - Debug (GPL)\"") # We might want to save the config log file @@ -366,20 +369,8 @@ fi (cd mysql-release-%{mysql_version} && CFLAGS=\"$CFLAGS\" \ CXXFLAGS=\"$CXXFLAGS\" \ -BuildMySQL "--enable-shared \ - --with-innodb \ -%if %{CLUSTER_BUILD} - --with-ndbcluster \ -%else - --without-ndbcluster \ -%endif - --with-archive-storage-engine \ - --with-csv-storage-engine \ - --with-blackhole-storage-engine \ - --with-federated-storage-engine \ - --with-partition \ +BuildMySQL "\ --with-embedded-server \ - --with-big-tables \ --with-comment=\"MySQL Community Server (GPL)\"") # We might want to save the config log file if test -n "$MYSQL_CONFLOG_DEST" @@ -700,7 +691,6 @@ fi %attr(755, root, root) %{_bindir}/msql2mysql %attr(755, root, root) %{_bindir}/mysql %attr(755, root, root) %{_bindir}/mysql_find_rows -%attr(755, root, root) %{_bindir}/mysql_upgrade_shell %attr(755, root, root) %{_bindir}/mysql_waitpid %attr(755, root, root) %{_bindir}/mysqlaccess %attr(755, root, root) %{_bindir}/mysqladmin @@ -840,6 +830,11 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Thu Nov 06 2008 Kent Boortz + +- Removed "mysql_upgrade_shell" +- Removed some copy/paste between debug and normal build + * Thu Nov 06 2008 Joerg Bruehe - Modify CFLAGS and CXXFLAGS such that a debug build is not optimized. -- cgit v1.2.1 From e6f397a1635e7211fea58abe935733c8f8d7cef7 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Fri, 7 Nov 2008 18:38:40 +0100 Subject: "spec" file for RPM builds: Fix yesterday's patch so that it also works for the last flag. Still part of the fix for bug#40546. support-files/mysql.spec.sh: The original "sed" command relied on a blank following the flag which should be removed for debug builds. This meant the last flag would not be matched. Change it so that the whole string is enclosed in blanks, demand leading and trailing blank for each flag, and finally strip the leading + trailing blank. --- support-files/mysql.spec.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index dc80d379b83..7bb35e6072e 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -320,8 +320,12 @@ do # We are in a subshell, so we can modify variables just for one run. if test "$servertype" != ' ' then - CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //'` - CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //'` + CFLAGS=`echo " $CFLAGS " | \ + sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \ + -e 's/^ //' -e 's/ $//'` + CXXFLAGS=`echo " $CXXFLAGS " | \ + sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \ + -e 's/^ //' -e 's/ $//'` fi BuildMySQL "\ @@ -807,6 +811,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Fri Nov 07 2008 Joerg Bruehe + +- Correct yesterday's fix, so that it also works for the last flag. + * Thu Nov 06 2008 Joerg Bruehe - Modify CFLAGS and CXXFLAGS such that a debug build is not optimized. -- cgit v1.2.1 From 2639b27d27be02795118475d5e65aeb9e3df1437 Mon Sep 17 00:00:00 2001 From: Build Team Date: Sun, 9 Nov 2008 03:14:35 +0100 Subject: Added the default configure COMMUNITY_SERVER and ENABLED_PROFILING to the Windows configuration file "include/config-win.h". --- include/config-win.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/config-win.h b/include/config-win.h index cc2b2767663..e0e754e5c09 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -371,6 +371,9 @@ inline double ulonglong2double(ulonglong value) #define HAVE_OPENSSL 1 #define HAVE_YASSL 1 +#define COMMUNITY_SERVER 1 +#define ENABLED_PROFILING 1 + /* Define charsets you want */ /* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_ascii */ -- cgit v1.2.1 From e85fe79430d74f4ca4f972bf13594a5c1fbcddb2 Mon Sep 17 00:00:00 2001 From: Build Team Date: Mon, 10 Nov 2008 21:21:49 +0100 Subject: Added "Sun Microsystems, Inc." to copyright headers on files modified since Oct 1st --- Makefile.am | 2 +- client/mysqldump.c | 2 +- include/config-win.h | 2 +- include/hash.h | 2 +- include/thr_lock.h | 2 +- mysql-test/lib/mtr_report.pl | 2 +- mysys/hash.c | 2 +- sql/event_db_repository.cc | 2 +- sql/event_parse_data.cc | 2 +- sql/event_parse_data.h | 2 +- sql/field.cc | 2 +- sql/field.h | 2 +- sql/ha_partition.cc | 2 +- sql/ha_partition.h | 2 +- sql/handler.cc | 2 +- sql/handler.h | 2 +- sql/item.cc | 2 +- sql/item.h | 2 +- sql/item_func.cc | 2 +- sql/item_func.h | 2 +- sql/lock.cc | 2 +- sql/log.cc | 2 +- sql/log_event.cc | 2 +- sql/mysql_priv.h | 2 +- sql/mysqld.cc | 2 +- sql/opt_range.cc | 2 +- sql/partition_info.h | 2 +- sql/set_var.cc | 2 +- sql/sp_head.cc | 2 +- sql/sql_base.cc | 2 +- sql/sql_cache.cc | 2 +- sql/sql_class.cc | 2 +- sql/sql_class.h | 2 +- sql/sql_insert.cc | 2 +- sql/sql_lex.cc | 2 +- sql/sql_lex.h | 2 +- sql/sql_parse.cc | 2 +- sql/sql_partition.cc | 2 +- sql/sql_select.cc | 2 +- sql/sql_show.cc | 2 +- sql/sql_show.h | 2 +- sql/sql_table.cc | 2 +- sql/sql_union.cc | 2 +- sql/sql_update.cc | 2 +- sql/sql_yacc.yy | 2 +- sql/table.cc | 2 +- sql/table.h | 2 +- storage/blackhole/ha_blackhole.cc | 2 +- storage/blackhole/ha_blackhole.h | 2 +- 49 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Makefile.am b/Makefile.am index 26670c42305..f3b9c29da1f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB +# Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/client/mysqldump.c b/client/mysqldump.c index c068b2ff16e..44c53a0e4c2 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/include/config-win.h b/include/config-win.h index e0e754e5c09..c111d14a17a 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/include/hash.h b/include/hash.h index 1f094d48585..f4b82454b81 100644 --- a/include/hash.h +++ b/include/hash.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/include/thr_lock.h b/include/thr_lock.h index 77d428d1805..c7754ada299 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index 3c78c3ca064..d02409d4cde 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright 2004-2008 MySQL AB, 2008 Sun Microsystems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysys/hash.c b/mysys/hash.c index 65a60c9e341..dd2d589e509 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index c26b740d24a..9a253d74546 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2006 MySQL AB +/* Copyright 2004-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index df419e92d0d..63ecc3006dd 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/event_parse_data.h b/sql/event_parse_data.h index 87a800c2078..8b42eb23937 100644 --- a/sql/event_parse_data.h +++ b/sql/event_parse_data.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/field.cc b/sql/field.cc index a03beb4e8af..8a70377920c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/field.h b/sql/field.h index 81905cc64ae..d24dd9355b0 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 303a2c152fb..4fe143bb9ed 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 685f057dfce..8aa4c3d7d78 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/handler.cc b/sql/handler.cc index 035a06c6f05..e124d97d9d1 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/handler.h b/sql/handler.h index b7d4d689d40..3958748f058 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item.cc b/sql/item.cc index 93d00c287ae..61ae78a9386 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item.h b/sql/item.h index 00a2759a739..81ca1bccae3 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item_func.cc b/sql/item_func.cc index d7e6fc1f8f2..9c41b70eade 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item_func.h b/sql/item_func.h index d84abdb6e56..ede08245319 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/lock.cc b/sql/lock.cc index faddb8c586c..f36e8d605d3 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/log.cc b/sql/log.cc index fb8669a5731..a36a0c14d07 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/log_event.cc b/sql/log_event.cc index 0d03593946d..51e124227a4 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index d11f2838e3a..f07a01cc8d8 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d59ea8eca45..57f6ae7bc40 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f228551b586..ccf6cbf745a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/partition_info.h b/sql/partition_info.h index 703b92305b1..415f955d5d4 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 MySQL AB +/* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/set_var.cc b/sql/set_var.cc index a62cafc3873..17585f17dfe 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 534cd0a7ca1..ef6cb556f4c 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright 2002-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f18ee0ec562..9038b4d4125 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 81d0d447ac1..2fca739f667 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 12b773c91d0..da24b1cf39d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_class.h b/sql/sql_class.h index f5cf31d1030..d726ce90521 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 8762d3dc8fa..ecdbcda1616 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 4ac73baa992..b2caec86db9 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 53ae984e795..a93ad4f2312 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 704c16cfdec..8a4dd1f0812 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index a45664a9767..41bbd90fabb 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 102809f9f64..032517234c6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fc2c2548cc4..6cdc3b1fa99 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_show.h b/sql/sql_show.h index 3baaef00a7d..fa067a46033 100644 --- a/sql/sql_show.h +++ b/sql/sql_show.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 MySQL AB +/* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_table.cc b/sql/sql_table.cc index c866fdfc173..ae30b91f7de 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2004 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 2f3282f58f6..fd3036e3d80 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 197e5290aba..ff47f5e4cd7 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8d9b3a2d4b5..6965f43b42c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/table.cc b/sql/table.cc index 89714e4e47e..9d06992a3a9 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/table.h b/sql/table.h index ccd6b60664e..38a66f9f426 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 1a1a0d02375..357496fe095 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index 085840cce43..289e449be10 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.1 From 1c9df573c9c0903e4daaac90b7defd52a52ed337 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Wed, 12 Nov 2008 13:36:53 +0100 Subject: Bug#38784: Mysql server crash if table is altered with partition changes. Occurred with EXTRA_DEBUG on windows. Problem was insufficient length of a local variable that stored path names. Solution was to use the correct length. CMakeLists.txt: Bug#38784: Mysql server crash if table is altered with partition changes. Added support for EXTRA_DEBUG sql/sql_partition.cc: Bug#38784: Mysql server crash if table is altered with partition changes. Changed from FN_LEN to FN_REFLEN since the variable was use for paths, not filenames without path. win/configure.js: Bug#38784: Mysql server crash if table is altered with partition changes. Added support for EXTRA_DEBUG --- CMakeLists.txt | 4 ++++ sql/sql_partition.cc | 22 +++++++++++----------- win/configure.js | 1 + 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7107a112f19..2f6e1236542 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,10 @@ IF(CYBOZU) ADD_DEFINITIONS(-DCYBOZU) ENDIF(CYBOZU) +IF(EXTRA_DEBUG) + ADD_DEFINITIONS(-D EXTRA_DEBUG) +ENDIF(EXTRA_DEBUG) + # in some places we use DBUG_OFF SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF") diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 5ed64ea8fd5..8eabded623c 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -5304,8 +5304,8 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, DDL_LOG_ENTRY ddl_log_entry; partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; - char tmp_path[FN_LEN]; - char normal_path[FN_LEN]; + char tmp_path[FN_REFLEN]; + char normal_path[FN_REFLEN]; List_iterator part_it(part_info->partitions); uint temp_partitions= part_info->temp_partitions.elements; uint no_elements= part_info->partitions.elements; @@ -5516,7 +5516,7 @@ static bool write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL; - char shadow_path[FN_LEN]; + char shadow_path[FN_REFLEN]; DBUG_ENTER("write_log_drop_shadow_frm"); build_table_shadow_filename(shadow_path, sizeof(shadow_path), lpt); @@ -5559,8 +5559,8 @@ static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry; - char path[FN_LEN]; - char shadow_path[FN_LEN]; + char path[FN_REFLEN]; + char shadow_path[FN_REFLEN]; DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry; DBUG_ENTER("write_log_rename_frm"); @@ -5610,8 +5610,8 @@ static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry; - char tmp_path[FN_LEN]; - char path[FN_LEN]; + char tmp_path[FN_REFLEN]; + char path[FN_REFLEN]; uint next_entry= 0; DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry; DBUG_ENTER("write_log_drop_partition"); @@ -5669,8 +5669,8 @@ static bool write_log_add_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL; - char tmp_path[FN_LEN]; - char path[FN_LEN]; + char tmp_path[FN_REFLEN]; + char path[FN_REFLEN]; uint next_entry= 0; DBUG_ENTER("write_log_add_change_partition"); @@ -5723,8 +5723,8 @@ static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) partition_info *part_info= lpt->part_info; DDL_LOG_MEMORY_ENTRY *log_entry; DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry; - char path[FN_LEN]; - char shadow_path[FN_LEN]; + char path[FN_REFLEN]; + char shadow_path[FN_REFLEN]; DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry; uint next_entry= 0; DBUG_ENTER("write_log_final_change_partition"); diff --git a/win/configure.js b/win/configure.js index c86ec0cf47c..ac51b15b9f0 100644 --- a/win/configure.js +++ b/win/configure.js @@ -48,6 +48,7 @@ try case "__NT__": case "CYBOZU": case "EMBED_MANIFESTS": + case "EXTRA_DEBUG": case "WITH_EMBEDDED_SERVER": configfile.WriteLine("SET (" + args.Item(i) + " TRUE)"); break; -- cgit v1.2.1 From bfba620e45a74e458dd121f5f2e838760d80cd19 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 14 Nov 2008 17:29:38 +0100 Subject: Changes of copyright output from "--version" and similar. Changes of copyright in RPM spec file. --- client/mysql.cc | 2 +- client/mysqladmin.cc | 4 ++-- client/mysqlimport.c | 2 +- client/mysqlshow.c | 2 +- sql/gen_lex_hash.cc | 2 +- storage/archive/archive_reader.c | 2 +- storage/myisam/myisampack.c | 2 +- storage/ndb/docs/doxygen/postdoxy.pl | 4 ++-- strings/conf_to_src.c | 2 +- support-files/mysql.spec.sh | 36 ++++++++++++++++++++++-------------- 10 files changed, 33 insertions(+), 25 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 024194d81f6..2d1a3bbedea 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1535,7 +1535,7 @@ static void usage(int version) if (version) return; printf("\ -Copyright (C) 2000-2008 MySQL AB\n\ +Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n\ This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\ and you are welcome to modify and redistribute it under the GPL license\n"); printf("Usage: %s [OPTIONS] [database]\n", my_progname); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index b3b699f61fd..4111670bad3 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -634,7 +634,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) case ADMIN_VER: new_line=1; print_version(); - puts("Copyright (C) 2000-2006 MySQL AB"); + puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); printf("Server version\t\t%s\n", mysql_get_server_info(mysql)); printf("Protocol version\t%d\n", mysql_get_proto_info(mysql)); @@ -1023,7 +1023,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2000-2006 MySQL AB"); + puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Administration program for the mysqld daemon."); printf("Usage: %s [OPTIONS] command command....\n", my_progname); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index ac3b0e8efba..09ba27b287a 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -193,7 +193,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2000-2006 MySQL AB"); + puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); printf("\ Loads tables from text files in various formats. The base name of the\n\ diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 167ff5c6198..0e696aed211 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -249,7 +249,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2000-2006 MySQL AB"); + puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Shows the structure of a mysql database (databases,tables and columns)\n"); printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname); diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 7b2395673eb..214ee4c99d2 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -451,7 +451,7 @@ int main(int argc,char **argv) printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n"); printf("\ -/* Copyright (C) 2001-2004 MySQL AB\n\ +/* Copyright 2001-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n\ \n\ This program is free software; you can redistribute it and/or modify\n\ it under the terms of the GNU General Public License as published by\n\ diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index bfc01073161..18764151775 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -374,7 +374,7 @@ static struct my_option my_long_options[] = static void usage(void) { print_version(); - puts("Copyright (C) 2007 MySQL AB"); + puts("Copyright 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\ \nand you are welcome to modify and redistribute it under the GPL \ license\n"); diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 0ca6a10fad4..908c32e48d3 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -300,7 +300,7 @@ static void print_version(void) static void usage(void) { print_version(); - puts("Copyright (C) 2002 MySQL AB"); + puts("Copyright 2002-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); puts("and you are welcome to modify and redistribute it under the GPL license\n"); diff --git a/storage/ndb/docs/doxygen/postdoxy.pl b/storage/ndb/docs/doxygen/postdoxy.pl index ad0edb44a31..3bf54e4ff75 100755 --- a/storage/ndb/docs/doxygen/postdoxy.pl +++ b/storage/ndb/docs/doxygen/postdoxy.pl @@ -81,9 +81,9 @@ open (OUTFILE, "> ${destdir}/doxygen.sty.new") while () { if (/\\rfoot/) { - print OUTFILE "\\rfoot[\\fancyplain{}{\\bfseries\\small \\copyright~Copyright 2003-2004 MySQL AB\\hfill support-cluster\@mysql.com}]{}\n"; + print OUTFILE "\\rfoot[\\fancyplain{}{\\bfseries\\small \\copyright~Copyright 2003-2008 MySQL AB, 2008 Sun Microsystems, Inc.\\hfill support-cluster\@mysql.com}]{}\n"; } elsif (/\\lfoot/) { - print OUTFILE "\\lfoot[]{\\fancyplain{}{\\bfseries\\small support-cluster\@mysql.com\\hfill \\copyright~Copyright 2003-2004 MySQL AB}}\n"; + print OUTFILE "\\lfoot[]{\\fancyplain{}{\\bfseries\\small support-cluster\@mysql.com\\hfill \\copyright~Copyright 2003-2008 MySQL AB, 2008 Sun Microsystems, Inc.}}\n"; } else { print OUTFILE; } diff --git a/strings/conf_to_src.c b/strings/conf_to_src.c index dc2a300a2ec..7e742050aa8 100644 --- a/strings/conf_to_src.c +++ b/strings/conf_to_src.c @@ -249,7 +249,7 @@ static void fprint_copyright(FILE *file) { fprintf(file, -"/* Copyright (C) 2000-2007 MySQL AB\n" +"/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n" "\n" " This program is free software; you can redistribute it and/or modify\n" " it under the terms of the GNU General Public License as published by\n" diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 790e7c830ac..937fdbc3789 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2007 MySQL AB +# Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,7 +15,11 @@ # MA 02110-1301 USA. %define mysql_version @VERSION@ -%define mysql_vendor MySQL AB + +# NOTE: "vendor" is used in upgrade/downgrade check, so you can't +# change these, has to be exactly as is. +%define mysql_old_vendor MySQL AB +%define mysql_vendor Sun Microsystems, Inc. # use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x) # to enable static linking (off by default) @@ -37,8 +41,7 @@ %else %define release 0.glibc23 %endif -%define license GPL -%define mysqld_user mysql +%define mysqld_user mysql %define mysqld_group mysql %define server_suffix -standard %define mysqldatadir /var/lib/mysql @@ -71,10 +74,10 @@ Summary: MySQL: a very fast and reliable SQL database server Group: Applications/Databases Version: @MYSQL_NO_DASH_VERSION@ Release: %{release} -License: %{license} +License: Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Under GPL license as shown in the Description field. Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz URL: http://www.mysql.com/ -Packager: MySQL Production Engineering Team +Packager: Sun Microsystems, Inc. Product Engineering Team Vendor: %{mysql_vendor} Provides: msqlormysql MySQL-server mysql BuildRequires: ncurses-devel @@ -90,9 +93,11 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of -MySQL AB. +Sun Microsystems, Inc. + +Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved. +Use is subject to license terms. -Copyright (C) 2000-2007 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license. @@ -112,9 +117,11 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. MySQL is a trademark of -MySQL AB. +Sun Microsystems, Inc. + +Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved. +Use is subject to license terms. -Copyright (C) 2000-2007 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license. @@ -455,6 +462,7 @@ installed=`rpm -q --whatprovides mysql-server 2> /dev/null` if [ $? -eq 0 -a -n "$installed" ]; then vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` + myoldvendor='%{mysql_old_vendor}' myvendor='%{mysql_vendor}' myversion='%{mysql_version}' @@ -466,12 +474,12 @@ if [ $? -eq 0 -a -n "$installed" ]; then [ -z "$new_family" ] && new_family="" error_text= - if [ "$vendor" != "$myvendor" ]; then + if [ "$vendor" != "$myoldvendor" -a "$vendor" != "$myvendor" ]; then error_text="$error_text The current MySQL server package is provided by a different -vendor ($vendor) than $myvendor. Some files may be installed -to different locations, including log files and the service -startup script in %{_sysconfdir}/init.d/. +vendor ($vendor) than $myoldvendor or $myvendor. +Some files may be installed to different locations, including log +files and the service startup script in %{_sysconfdir}/init.d/. " fi -- cgit v1.2.1 From 065321f0be594e5229409996205e6a271477c255 Mon Sep 17 00:00:00 2001 From: V Narayanan Date: Tue, 18 Nov 2008 11:31:03 +0530 Subject: Bug#39616: Missing quotes from .CSV crashes server When a CSV file contained comma separated elements that were not enclosed in quotes, it was causing the mysql server to crash. The old algorithm that parsed the content of a row in mysql 5.0 was assuming that the values of the fields in a .CSV file will be enclosed in quotes and will be separated by commas. This was causing the old algorithm to fail when the content of the file resembled the following 3,"sans quotes" The CSV engine that is part of mysql 5.0 was expecting the above to be "3","sans quotes" The above is just one example of where the engine was failing for what would be recognized as a valid .CSV file content otherwise. The proposed fix changes the old algorithm being used to parse rows from the .CSV file to handle two separate cases 1) When the current field of the row is enclosed in quotes 2) When the current field of the row is not enclosed in quotes mysql-test/r/csv.result: Contains additional test output corresponding to the new tests added. mysql-test/t/csv.test: Contains additional tests for testing the behaviour of the CSV storage engine when the fields are not enclosed in quotes. sql/examples/ha_tina.cc: Changes the parsing logic of the rows in a CSV file to account for fields that are not enclosed in quotes. --- mysql-test/r/csv.result | 15 +++++++ mysql-test/t/csv.test | 43 +++++++++++++++++++++ sql/examples/ha_tina.cc | 101 ++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 138 insertions(+), 21 deletions(-) diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index dca4e349c8a..ac1aee6cc9a 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5071,4 +5071,19 @@ select * from t1; a foo drop table t1; +create table bug39616_1(id int NOT NULL, d varchar(50) NOT NULL) ENGINE=csv; +select * from bug39616_1; +id d +1 integer sans quotes +1 string sans quotes +1 string end quotes" +1 quotes"in between" strings +1 Integer with quote and string with no quote +1 escape sequence + " \ \a within quotes +drop table bug39616_1; +create table bug39616_1(id int NOT NULL, d varchar(50) NOT NULL) ENGINE=csv; +select * from bug39616_1; +id d +drop table bug39616_1; End of 5.0 tests diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index db5cb92c3e6..72d61fc7781 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1460,4 +1460,47 @@ insert into t1 values(); select * from t1; drop table t1; +# +# Bug #39616 Missing quotes from .CSV crashes server +# +# Editing the .CSV file and leaving out quotes from around an integer field +# crashes the server. +# + +# +# Test for the integers and strings enclosed in quotes, not enclosed in quotes, +# \X characters. +# +create table bug39616_1(id int NOT NULL, d varchar(50) NOT NULL) ENGINE=csv; + +--remove_file $MYSQLTEST_VARDIR/master-data/test/bug39616_1.CSV +--write_file $MYSQLTEST_VARDIR/master-data/test/bug39616_1.CSV +1,"integer sans quotes" +1,string sans quotes +1,string end quotes" +1,quotes"in between" strings +"1",Integer with quote and string with no quote +1,"escape sequence \n \" \\ \r \a within quotes" +EOF + +select * from bug39616_1; + +drop table bug39616_1; + +# +# Test for he case when a field begins with a quote, but does not end in a +# quote. +# Note: This results in an empty set. +# +create table bug39616_1(id int NOT NULL, d varchar(50) NOT NULL) ENGINE=csv; + +--remove_file $MYSQLTEST_VARDIR/master-data/test/bug39616_1.CSV +--write_file $MYSQLTEST_VARDIR/master-data/test/bug39616_1.CSV +1,"string only at the beginning quotes +EOF + +select * from bug39616_1; + +drop table bug39616_1; + --echo End of 5.0 tests diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 0b57fe86e62..aaaa3b8ffb4 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -416,37 +416,96 @@ int ha_tina::find_current_row(byte *buf) if ((end_ptr= find_eoln(share->mapped_file, current_position, share->file_stat.st_size)) == 0) DBUG_RETURN(HA_ERR_END_OF_FILE); + /* + Parse the line obtained using the following algorithm + + BEGIN + 1) Store the EOL (end of line) for the current row + 2) Until all the fields in the current query have not been + filled + 2.1) If the current character begins with a quote + 2.1.1) Until EOL has not been reached + a) If end of current field is reached, move + to next field and jump to step 2.3 + b) If current character begins with \\ handle + \\n, \\r, \\, \\" + c) else append the current character into the buffer + before checking that EOL has not been reached. + 2.2) If the current character does not begin with a quote + 2.2.1) Until EOL has not been reached + a) If the end of field has been reached move to the + next field and jump to step 2.3 + b) append the current character into the buffer + 2.3) Store the current field value and jump to 2) + TERMINATE + */ + for (Field **field=table->field ; *field ; field++) { buffer.length(0); - mapped_ptr++; // Increment past the first quote - for(;mapped_ptr != end_ptr; mapped_ptr++) + /* Handle the case where the first character begins with a quote */ + if (*mapped_ptr == '"') { - //Need to convert line feeds! - if (*mapped_ptr == '"' && - (((mapped_ptr[1] == ',') && (mapped_ptr[2] == '"')) || (mapped_ptr == end_ptr -1 ))) + /* Increment past the first quote */ + mapped_ptr++; + /* Loop through the row to extract the values for the current field */ + for(; mapped_ptr != end_ptr; mapped_ptr++) { - mapped_ptr += 2; // Move past the , and the " - break; - } - if (*mapped_ptr == '\\' && mapped_ptr != (end_ptr - 1)) - { - mapped_ptr++; - if (*mapped_ptr == 'r') - buffer.append('\r'); - else if (*mapped_ptr == 'n' ) - buffer.append('\n'); - else if ((*mapped_ptr == '\\') || (*mapped_ptr == '"')) - buffer.append(*mapped_ptr); - else /* This could only happed with an externally created file */ + /* check for end of the current field */ + if (*mapped_ptr == '"' && + (mapped_ptr[1] == ',' || mapped_ptr == end_ptr -1 )) { - buffer.append('\\'); + /* Move past the , and the " */ + mapped_ptr += 2; + break; + } + if (*mapped_ptr == '\\' && mapped_ptr != (end_ptr - 1)) + { + mapped_ptr++; + if (*mapped_ptr == 'r') + buffer.append('\r'); + else if (*mapped_ptr == 'n' ) + buffer.append('\n'); + else if ((*mapped_ptr == '\\') || (*mapped_ptr == '"')) + buffer.append(*mapped_ptr); + else /* This could only happed with an externally created file */ + { + buffer.append('\\'); + buffer.append(*mapped_ptr); + } + } + else + { + /* + If no last quote was found, but the end of row has been reached + it implies that there has been error. + */ + if (mapped_ptr == end_ptr -1) + DBUG_RETURN(HA_ERR_END_OF_FILE); + /* Store current character in the buffer for the field */ buffer.append(*mapped_ptr); } - } - else + } + } + else + { + /* Handle the case where the current row does not start with quotes */ + + /* Loop through the row to extract the values for the current field */ + for (; mapped_ptr != end_ptr; mapped_ptr++) + { + /* check for end of current field */ + if (*mapped_ptr == ',') + { + /* Increment past the current comma */ + mapped_ptr++; + break; + } + /* store the current character in the buffer for the field */ buffer.append(*mapped_ptr); + } } + /* Store the field value from the buffer */ (*field)->store(buffer.ptr(), buffer.length(), buffer.charset()); } next_position= (end_ptr - share->mapped_file)+1; -- cgit v1.2.1 From 85c04371d794efdb0134a40320757c0d660596a4 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Thu, 20 Nov 2008 15:39:39 +0100 Subject: Bug#39591: Crash if table comment is longer than 62 characters It was possible to crash a mysqld build with EXTRA_DEBUG using CREATE TABLE ... COMMENT with a specially-crafted UTF-8 string. This CS removes the check that caused it since it no longer applies in current servers anyway, and adds comments instead to avoid future confusion. mysql-test/r/strict.result: Try to crash mysqld with a "suitable" multi-byte (3-byte UTF-8) string for a table comment. mysql-test/t/strict.test: Try to crash mysqld with a "suitable" multi-byte (3-byte UTF-8) string for a table comment. sql/unireg.cc: Talk at length about limits in .frm form-info, characters vs bytes, inlined vs extra-segement TABLE-COMMENTS, and the differences in 6.0+ vs <6.0 when it comes to UTF-8. Also, remove a check that no longer applies and that could lead to problems in pathological cases. --- mysql-test/r/strict.result | 7 +++++++ mysql-test/t/strict.test | 9 +++++++++ sql/unireg.cc | 26 ++++++++++++++++++-------- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 34869862a63..c31b5ea2189 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1348,6 +1348,13 @@ t1 CREATE TABLE `t1` ( `i` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*' drop table t1; +CREATE TABLE t3 (f1 INT) COMMENT 'כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן'; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `f1` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן' +DROP TABLE t3; set sql_mode= 'traditional'; create table t1(col1 tinyint, col2 tinyint unsigned, col3 smallint, col4 smallint unsigned, diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index 2b71bf1093c..f66c2913ac9 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -1199,6 +1199,15 @@ comment '123456789*123456789*123456789*123456789*123456789*123456789*'; show create table t1; drop table t1; +# +# Bug #39591: Crash if table comment is longer than 62 characters +# + +#60 chars, 120 (+1) bytes (UTF-8 with 2-byte chars) +CREATE TABLE t3 (f1 INT) COMMENT 'כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן'; +SHOW CREATE TABLE t3; +DROP TABLE t3; + # # Bug #26359: Strings becoming truncated and converted to numbers under STRICT mode # diff --git a/sql/unireg.cc b/sql/unireg.cc index b581ad4655a..f20d3e8cc6b 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -143,6 +143,24 @@ bool mysql_create_frm(THD *thd, my_string file_name, (create_info->min_rows == 1) && (keys == 0)); int2store(fileinfo+28,key_info_length); + /* + This gives us the byte-position of the character at + (character-position, not byte-position) TABLE_COMMENT_MAXLEN. + The trick here is that character-positions start at 0, so the last + character in a maximum-allowed length string would be at char-pos + MAXLEN-1; charpos MAXLEN will be the position of the terminator. + Consequently, bytepos(charpos(MAXLEN)) should be equal to + comment[length] (which should also be the terminator, or at least + the first byte after the payload in the strict sense). If this is + not so (bytepos(charpos(MAXLEN)) comes /before/ the end of the + string), the string is too long. + + For additional credit, realise that UTF-8 has 1-3 bytes before 6.0, + and 1-4 bytes in 6.0 (6.0 also has UTF-32). This means that the + inlined COMMENT supposedly does not exceed 60 character plus + terminator, vulgo, 181 bytes. + */ + tmp_len= system_charset_info->cset->charpos(system_charset_info, create_info->comment.str, create_info->comment.str + @@ -165,14 +183,6 @@ bool mysql_create_frm(THD *thd, my_string file_name, strmake((char*) forminfo+47, create_info->comment.str ? create_info->comment.str : "", create_info->comment.length); forminfo[46]=(uchar) create_info->comment.length; -#ifdef EXTRA_DEBUG - /* - EXTRA_DEBUG causes strmake() to initialize its buffer behind the - payload with a magic value to detect wrong buffer-sizes. We - explicitly zero that segment again. - */ - memset((char*) forminfo+47 + forminfo[46], 0, 61 - forminfo[46]); -#endif if (my_pwrite(file,(byte*) fileinfo,64,0L,MYF_RW) || my_pwrite(file,(byte*) keybuff,key_info_length, (ulong) uint2korr(fileinfo+6),MYF_RW)) -- cgit v1.2.1 From 74b354091946336ea8663652d4744b43a2c996e3 Mon Sep 17 00:00:00 2001 From: Build Team Date: Tue, 25 Nov 2008 03:04:58 +0100 Subject: mysql-test/r/partition.result mysql-test/t/partition.test sql/ha_partition.cc Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables Problem was usage of read_range_first with an empty key. Solution was to not to give a key if it was empty. (real author Mattias Jonsson) storage/archive/archive_reader.c client/mysqlslap.c Aligned the copyright texts output from "--version" of tools, to let internal tools be able to change them if needed. storage/ndb/test/tools/connect.cpp storage/ndb/test/run-test/atrt.hpp Corrected a few GPL headers not restricted to GPL version 2 Makefile.am Added missing --report-features to the 'test-bt-fast' target support-files/mysql.spec.sh Reversed the removal of the "%define license GPL" in as internal tools depended on it --- Makefile.am | 2 +- client/mysqlslap.c | 4 +--- mysql-test/r/partition.result | 12 ++++++++++++ mysql-test/t/partition.test | 15 +++++++++++++++ sql/ha_partition.cc | 3 ++- storage/archive/archive_reader.c | 4 +--- storage/ndb/test/run-test/atrt.hpp | 3 +-- storage/ndb/test/tools/connect.cpp | 3 +-- support-files/mysql.spec.sh | 7 ++++--- 9 files changed, 38 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index f3b9c29da1f..6d38ac4c7cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -180,7 +180,7 @@ test-bt: test-bt-fast: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=ps --force --timer \ - --skip-ndbcluster --ps-protocol + --skip-ndbcluster --ps-protocol --report-features -if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \ cd mysql-test ; \ MTR_BUILD_THREAD=auto \ diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 5ca0b1cd207..9ba912d646c 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -688,9 +688,7 @@ static void usage(void) { print_version(); puts("Copyright (C) 2005 MySQL AB"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\ - \nand you are welcome to modify and redistribute it under the GPL \ - license\n"); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Run a query multiple times against the server\n"); printf("Usage: %s [OPTIONS]\n",my_progname); print_defaults("my",load_default_groups); diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 289a24685ff..013663965ae 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,4 +1,16 @@ drop table if exists t1, t2; +CREATE TABLE t1 ( +pk INT NOT NULL AUTO_INCREMENT, +PRIMARY KEY (pk) +) +/*!50100 PARTITION BY HASH (pk) +PARTITIONS 2 */; +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1 WHERE pk < 0 ORDER BY pk; +pk +DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL, KEY(a)) PARTITION BY RANGE(a) (PARTITION p1 VALUES LESS THAN (200), PARTITION pmax VALUES LESS THAN MAXVALUE); diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index e016f72e75b..8648b8d5622 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -14,6 +14,21 @@ drop table if exists t1, t2; --enable_warnings +# +# Bug#40954: Crash if range search and order by. +# +CREATE TABLE t1 ( + pk INT NOT NULL AUTO_INCREMENT, + PRIMARY KEY (pk) +) +/*!50100 PARTITION BY HASH (pk) +PARTITIONS 2 */; +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1 WHERE pk < 0 ORDER BY pk; +DROP TABLE t1; + # # Bug#40494: Crash MYSQL server crashes on range access with partitioning # and order by diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 4fe143bb9ed..d262fbefbe7 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4429,7 +4429,8 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order) This can only read record to table->record[0], as it was set when the table was being opened. We have to memcpy data ourselves. */ - error= file->read_range_first(&m_start_key, end_range, eq_range, TRUE); + error= file->read_range_first(m_start_key.key? &m_start_key: NULL, + end_range, eq_range, TRUE); memcpy(rec_buf_ptr, table->record[0], m_rec_length); reverse_order= FALSE; break; diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c index 18764151775..84d4e318b49 100644 --- a/storage/archive/archive_reader.c +++ b/storage/archive/archive_reader.c @@ -375,9 +375,7 @@ static void usage(void) { print_version(); puts("Copyright 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc."); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\ - \nand you are welcome to modify and redistribute it under the GPL \ - license\n"); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); puts("Read and modify Archive files directly\n"); printf("Usage: %s [OPTIONS] file_to_be_looked_at [file_for_backup]\n", my_progname); print_defaults("my", load_default_groups); diff --git a/storage/ndb/test/run-test/atrt.hpp b/storage/ndb/test/run-test/atrt.hpp index 14d2dccd245..db26bd9bfc0 100644 --- a/storage/ndb/test/run-test/atrt.hpp +++ b/storage/ndb/test/run-test/atrt.hpp @@ -2,8 +2,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/storage/ndb/test/tools/connect.cpp b/storage/ndb/test/tools/connect.cpp index 2d3ac34d3e8..278dbe833ea 100644 --- a/storage/ndb/test/tools/connect.cpp +++ b/storage/ndb/test/tools/connect.cpp @@ -2,8 +2,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 937fdbc3789..a535e778281 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -41,6 +41,7 @@ %else %define release 0.glibc23 %endif +%define license GPL %define mysqld_user mysql %define mysqld_group mysql %define server_suffix -standard @@ -74,7 +75,7 @@ Summary: MySQL: a very fast and reliable SQL database server Group: Applications/Databases Version: @MYSQL_NO_DASH_VERSION@ Release: %{release} -License: Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Under GPL license as shown in the Description field. +License: Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Under %{license} license as shown in the Description field. Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz URL: http://www.mysql.com/ Packager: Sun Microsystems, Inc. Product Engineering Team @@ -361,7 +362,7 @@ CFLAGS="$CFLAGS" \ CXXFLAGS="$CXXFLAGS" \ BuildMySQL "\ --with-debug \ - --with-comment=\"MySQL Community Server - Debug (GPL)\"") + --with-comment=\"MySQL Community Server - Debug (%{license})\"") # We might want to save the config log file if test -n "$MYSQL_DEBUGCONFLOG_DEST" @@ -382,7 +383,7 @@ CFLAGS="$CFLAGS" \ CXXFLAGS="$CXXFLAGS" \ BuildMySQL "\ --with-embedded-server \ - --with-comment=\"MySQL Community Server (GPL)\"") + --with-comment=\"MySQL Community Server (%{license})\"") # We might want to save the config log file if test -n "$MYSQL_CONFLOG_DEST" then -- cgit v1.2.1 From 589ac1cfdcb44818caff300777223eac723dd762 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 28 Nov 2008 18:17:13 +0400 Subject: BUG#37245 - Full text search problem Certain boolean mode queries with truncation operator did not return matching records and calculate relevancy incorrectly. myisam/ft_boolean_search.c: Sort ftb->list in ascending order. This helps to fix binary search in ft_boolean_find_relevance() without rewriting it much. Fixed binary search in ft_boolean_find_relevance(), so it finds right-most element in an array. Fixed that ft_boolean_find_relevance() didn't return match for words with truncation operator in case query has other non- matching words. mysql-test/r/fulltext.result: A test case for BUG#37245. mysql-test/t/fulltext.test: A test case for BUG#37245. --- myisam/ft_boolean_search.c | 38 ++++++++++++++++++++++++++++++++------ mysql-test/r/fulltext.result | 9 +++++++++ mysql-test/t/fulltext.test | 9 +++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index 57de75ee4be..255c51fd33a 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -122,11 +122,11 @@ static int FTB_WORD_cmp(my_off_t *v, FTB_WORD *a, FTB_WORD *b) static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b) { - /* ORDER BY word DESC, ndepth DESC */ - int i= mi_compare_text(cs, (uchar*) (*b)->word+1,(*b)->len-1, - (uchar*) (*a)->word+1,(*a)->len-1,0,0); + /* ORDER BY word, ndepth */ + int i= mi_compare_text(cs, (uchar*) (*a)->word + 1, (*a)->len - 1, + (uchar*) (*b)->word + 1, (*b)->len - 1, 0, 0); if (!i) - i=CMP_NUM((*b)->ndepth,(*a)->ndepth); + i= CMP_NUM((*a)->ndepth, (*b)->ndepth); return i; } @@ -674,23 +674,49 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) (byte *) end, &word, TRUE)) { int a, b, c; + /* + Find right-most element in the array of query words matching this + word from a document. + */ for (a=0, b=ftb->queue.elements, c=(a+b)/2; b-a>1; c=(a+b)/2) { ftbw=ftb->list[c]; if (mi_compare_text(ftb->charset, (uchar*) word.pos, word.len, (uchar*) ftbw->word+1, ftbw->len-1, - (my_bool) (ftbw->flags&FTB_FLAG_TRUNC),0) >0) + (my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0) b=c; else a=c; } + /* + If there were no words with truncation operator, we iterate to the + beginning of an array until array element is equal to the word from + a document. This is done mainly because the same word may be + mentioned twice (or more) in the query. + + In case query has words with truncation operator we must iterate + to the beginning of the array. There may be non-matching query words + between matching word with truncation operator and the right-most + matching element. E.g., if we're looking for 'aaa15' in an array of + 'aaa1* aaa14 aaa15 aaa16'. + + Worse of that there still may be match even if the binary search + above didn't find matching element. E.g., if we're looking for + 'aaa15' in an array of 'aaa1* aaa14 aaa16'. The binary search will + stop at 'aaa16'. + */ for (; c>=0; c--) { ftbw=ftb->list[c]; if (mi_compare_text(ftb->charset, (uchar*) word.pos, word.len, (uchar*) ftbw->word+1,ftbw->len-1, (my_bool) (ftbw->flags&FTB_FLAG_TRUNC),0)) - break; + { + if (ftb->with_scan & FTB_FLAG_TRUNC) + continue; + else + break; + } if (ftbw->docid[1] == docid) continue; ftbw->docid[1]=docid; diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index e73f8af405c..6821691c9d0 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -497,3 +497,12 @@ WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref b b 5 const 4 Using where DROP TABLE t1; +CREATE TABLE t1(a CHAR(10)); +INSERT INTO t1 VALUES('aaa15'); +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1; +MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) +1 +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1; +MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) +2 +DROP TABLE t1; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index fa087d89efb..77d84c730d9 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -423,3 +423,12 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(b) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; DROP TABLE t1; + +# +# BUG#37245 - Full text search problem +# +CREATE TABLE t1(a CHAR(10)); +INSERT INTO t1 VALUES('aaa15'); +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1; +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1; +DROP TABLE t1; -- cgit v1.2.1 From 9e42a600177d24dd55169730fe848ebcb270fd5e Mon Sep 17 00:00:00 2001 From: Matthias Leich Date: Fri, 28 Nov 2008 16:45:34 +0100 Subject: - Fix for Bug#40179 Test main.query_cache failing randomly on Pushbuild, test weakness - disable the test suffering from Bug#41098 Query Cache returns wrong result with concurrent insert - additional improvements Details: - Move the test for the historic bug Bug 28249 Query Cache returns wrong result with concurrent insert / certain lock into its own testscript query_cache_28249.test. - query_cache.test: - replace error numbers with error names - remove trailing spaces, replace tabs with spaces - reset of @@global.log_bin_trust_function_creators to its original value at the end of the test - query_cache_28249.test: - replace sleep 5 with poll routine - avoid random differences caused by concurrent_inserts effects - improved comments and formatting --- mysql-test/r/query_cache.result | 38 +---------- mysql-test/r/query_cache_28249.result | 62 +++++++++++++++++ mysql-test/t/disabled.def | 1 + mysql-test/t/query_cache.test | 102 +++++----------------------- mysql-test/t/query_cache_28249.test | 124 ++++++++++++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 121 deletions(-) create mode 100644 mysql-test/r/query_cache_28249.result create mode 100644 mysql-test/t/query_cache_28249.test diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 34c86d6c8c6..3c8ff8faddc 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1116,12 +1116,13 @@ create procedure `p1`() begin select a, f1() from t1; end// +SET @log_bin_trust_function_creators = @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; call p1()// a f1() 1 2 2 2 -SET GLOBAL log_bin_trust_function_creators = 0; +SET GLOBAL log_bin_trust_function_creators = @log_bin_trust_function_creators; drop procedure p1// drop function f1// drop table t1// @@ -1615,41 +1616,6 @@ id DROP PROCEDURE proc29856; DROP TABLE t1; SET GLOBAL query_cache_size= default; -Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock -set GLOBAL query_cache_type=1; -set GLOBAL query_cache_limit=10000; -set GLOBAL query_cache_min_res_unit=0; -set GLOBAL query_cache_size= 100000; -flush tables; -drop table if exists t1, t2; -create table t1 (a int); -create table t2 (a int); -insert into t1 values (1),(2),(3); -Locking table T2 with a write lock. -lock table t2 write; -Select blocked by write lock. -select *, (select count(*) from t2) from t1;; -Sleeing is ok, because selecting should be done very fast. -Inserting into table T1. -insert into t1 values (4); -Unlocking the tables. -unlock tables; -Collecting result from previously blocked select. -Next select should contain 4 rows, as the insert is long finished. -select *, (select count(*) from t2) from t1; -a (select count(*) from t2) -1 0 -2 0 -3 0 -4 0 -reset query cache; -select *, (select count(*) from t2) from t1; -a (select count(*) from t2) -1 0 -2 0 -3 0 -4 0 -drop table t1,t2; # # Bug#25132 disabled query cache: Qcache_free_blocks = 1 # diff --git a/mysql-test/r/query_cache_28249.result b/mysql-test/r/query_cache_28249.result new file mode 100644 index 00000000000..aed84911032 --- /dev/null +++ b/mysql-test/r/query_cache_28249.result @@ -0,0 +1,62 @@ +SET @query_cache_type= @@global.query_cache_type; +SET @query_cache_limit= @@global.query_cache_limit; +SET @query_cache_min_res_unit= @@global.query_cache_min_res_unit; +SET @query_cache_size= @@global.query_cache_size; +# Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock +# Establish connections user1,user2,user3 (user=root) +# Switch to connection user1 +SET GLOBAL query_cache_type=1; +SET GLOBAL query_cache_limit=10000; +SET GLOBAL query_cache_min_res_unit=0; +SET GLOBAL query_cache_size= 100000; +FLUSH TABLES; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# Switch to connection user2 +LOCK TABLE t2 WRITE; +# Switch to connection user1 +# "send" the next select, "reap" the result later. +# The select will be blocked by the write lock on the t1. +SELECT *, (SELECT COUNT(*) FROM t2) FROM t1; +# Switch to connection user3 +# Poll till the select of connection user1 is blocked by the write lock on t1. +SELECT user,command,state,info FROM information_schema.processlist +WHERE state = 'Locked' + AND info = 'SELECT *, (SELECT COUNT(*) FROM t2) FROM t1'; +user command state info +root Query Locked SELECT *, (SELECT COUNT(*) FROM t2) FROM t1 +INSERT INTO t1 VALUES (4); +# Switch to connection user2 +UNLOCK TABLES; +# Switch to connection user1 +# Collecting ("reap") the result from the previously blocked select. +# The printing of the result (varies between 3 and 4 rows) set has to be suppressed. +# Switch to connection user3 +# The next select enforces that effects of "concurrent_inserts" like the +# record with a = 4 is missing in result sets can no more happen. +SELECT 1 FROM t1 WHERE a = 4; +1 +1 +# Switch to connection user1 +# The next result set must contain 4 rows. +SELECT *, (SELECT COUNT(*) FROM t2) FROM t1; +a (SELECT COUNT(*) FROM t2) +1 0 +2 0 +3 0 +4 0 +RESET QUERY CACHE; +SELECT *, (SELECT COUNT(*) FROM t2) FROM t1; +a (SELECT COUNT(*) FROM t2) +1 0 +2 0 +3 0 +4 0 +DROP TABLE t1,t2; +# Switch to connection default + close connections user1,user2,user3 +SET GLOBAL query_cache_type= @query_cache_type; +SET GLOBAL query_cache_limit= @query_cache_limit; +SET GLOBAL query_cache_min_res_unit= @query_cache_min_res_unit; +SET GLOBAL query_cache_size= @query_cache_size; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index c01bb4b9e44..748c80548d9 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -12,3 +12,4 @@ federated_transactions : Bug#29523 Transactions do not work log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions +query_cache_28249 : Bug#41098 Query Cache returns wrong result with concurrent insert diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 88287e53b34..296914c985b 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -300,7 +300,7 @@ select * from t1; select * from t1; show status like "Qcache_queries_in_cache"; insert delayed into t1 values (4); ---sleep 5 # Wait for insert delayed to be executed. +--sleep 5 # Wait for insert delayed to be executed. select a from t1; show status like "Qcache_queries_in_cache"; drop table t1; @@ -410,10 +410,10 @@ create table t1(id int auto_increment primary key); insert into t1 values (NULL), (NULL), (NULL); select * from t1 where id=2; alter table t1 rename to t2; --- error 1146 +--error ER_NO_SUCH_TABLE select * from t1 where id=2; drop table t2; --- error 1146 +--error ER_NO_SUCH_TABLE select * from t1 where id=2; # @@ -435,7 +435,7 @@ create table t1 (a int); insert into t1 values (1),(2),(3); show status like "Qcache_queries_in_cache"; select * from t1 into outfile "query_cache.out.file"; ---error 1086 +--error ER_FILE_EXISTS_ERROR select * from t1 into outfile "query_cache.out.file"; select * from t1 limit 1 into dumpfile "query_cache.dump.file"; show status like "Qcache_queries_in_cache"; @@ -537,7 +537,7 @@ drop table t1; # If at least one of the above variables has changed, # the cached query can't be reused. In the below test # absolutely the same query is used several times, -# SELECT should fetch different results for every instance. +# SELECT should fetch different results for every instance. # No hits should be produced. # New cache entry should appear for every SELECT. # @@ -554,21 +554,21 @@ show status like "Qcache_queries_in_cache"; # Change collation_connection and run the same query again # set collation_connection=koi8r_bin; -SELECT a,'',''='' FROM t1; +SELECT a,'',''='' FROM t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; # # Now change character_set_client and run the same query again # set character_set_client=cp1251; -SELECT a,'',''='' FROM t1; +SELECT a,'',''='' FROM t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; # # And finally change character_set_results and run the same query again # set character_set_results=cp1251; -SELECT a,'',''='' FROM t1; +SELECT a,'',''='' FROM t1; show status like "Qcache_hits"; show status like "Qcache_queries_in_cache"; SET NAMES default; @@ -602,12 +602,12 @@ insert into t1 set c = repeat('x',24); insert into t1 set c = concat(repeat('x',24),'x'); insert into t1 set c = concat(repeat('x',24),'w'); insert into t1 set c = concat(repeat('x',24),'y'); -set max_sort_length=200; +set max_sort_length=200; select c from t1 order by c, id; reset query cache; set max_sort_length=20; select c from t1 order by c, id; -set max_sort_length=200; +set max_sort_length=200; select c from t1 order by c, id; set max_sort_length=default; # sql_mode @@ -801,9 +801,10 @@ create procedure `p1`() begin select a, f1() from t1; end// +SET @log_bin_trust_function_creators = @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; call p1()// -SET GLOBAL log_bin_trust_function_creators = 0; +SET GLOBAL log_bin_trust_function_creators = @log_bin_trust_function_creators; drop procedure p1// drop function f1// @@ -1016,7 +1017,7 @@ set GLOBAL query_cache_size= default; # -# Bug #28897 UUID() returns non-unique values when query cache is enabled +# Bug#28897 UUID() returns non-unique values when query cache is enabled # set GLOBAL query_cache_size=1000000; @@ -1025,7 +1026,7 @@ create table t1 (a char); insert into t1 values ('c'); let $q1= `select UUID(), a from t1`; -let $q2= `select UUID(), a from t1`; +let $q2= `select UUID(), a from t1`; # disabling the logging of the query because the UUIDs are different each run. --disable_query_log @@ -1046,7 +1047,7 @@ create table t1 (a char); insert into t1 values ('c'); let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`; -let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`; +let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`; # disabling the logging of the query because the times are different each run. --disable_query_log @@ -1181,75 +1182,6 @@ DROP PROCEDURE proc29856; DROP TABLE t1; SET GLOBAL query_cache_size= default; -# -# Bug #28249 Query Cache returns wrong result with concurrent insert / certain lock -# ---echo Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock -connect (user1,localhost,root,,test,,); -connect (user2,localhost,root,,test,,); -connect (user3,localhost,root,,test,,); - -connection user1; - -set GLOBAL query_cache_type=1; -set GLOBAL query_cache_limit=10000; -set GLOBAL query_cache_min_res_unit=0; -set GLOBAL query_cache_size= 100000; - -flush tables; ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -create table t1 (a int); -create table t2 (a int); -insert into t1 values (1),(2),(3); -connection user2; ---echo Locking table T2 with a write lock. -lock table t2 write; - -connection user1; ---echo Select blocked by write lock. ---send select *, (select count(*) from t2) from t1; ---echo Sleeing is ok, because selecting should be done very fast. -sleep 5; - -connection user3; ---echo Inserting into table T1. -insert into t1 values (4); - -connection user2; ---echo Unlocking the tables. -unlock tables; - -connection user1; ---echo Collecting result from previously blocked select. -# -# Since the lock ordering rule in thr_multi_lock depends on -# pointer values, from execution to execution we might have -# different lock order, and therefore, sometimes lock t1 and block -# on t2, and sometimes block on t2 right away. In the second case, -# the following insert succeeds, and only then this select can -# proceed, and we actually test nothing, as the very first select -# returns 4 rows right away. -# It's fine to have a test case that covers the problematic area -# at least once in a while. -# We, however, need to disable the result log here to make the -# test repeatable. ---disable_result_log ---reap ---enable_result_log ---echo Next select should contain 4 rows, as the insert is long finished. -select *, (select count(*) from t2) from t1; -reset query cache; -select *, (select count(*) from t2) from t1; - -drop table t1,t2; - -connection default; -disconnect user1; -disconnect user2; -disconnect user3; - # --echo # --echo # Bug#25132 disabled query cache: Qcache_free_blocks = 1 @@ -1260,7 +1192,7 @@ set global query_cache_type=0; show status like 'Qcache_free_blocks'; --echo Restore default values. -# Bug #28211 RENAME DATABASE and query cache don't play nicely together +# Bug#28211 RENAME DATABASE and query cache don't play nicely together # # TODO: enable these tests when RENAME DATABASE is implemented. # --disable_warnings @@ -1278,7 +1210,7 @@ show status like 'Qcache_free_blocks'; # show status like 'Qcache_queries_in_cache'; # drop database db2; # set global query_cache_size=default; -# +# # --disable_warnings # drop database if exists db1; # drop database if exists db3; diff --git a/mysql-test/t/query_cache_28249.test b/mysql-test/t/query_cache_28249.test new file mode 100644 index 00000000000..021c13cb54a --- /dev/null +++ b/mysql-test/t/query_cache_28249.test @@ -0,0 +1,124 @@ +### t/query_cache_28249.test ### +# +# Test for +# Bug #28249 Query Cache returns wrong result with concurrent insert / certain lock +# +# Last modification: +# 2008-11-27 mleich - Move this test out of query_cache.test +# - Fix Bug#40179 Test main.query_cache failing randomly on Pushbuild, +# test weakness +# - Minor improvements (comments,formatting etc.) +# + +--source include/have_query_cache.inc + +SET @query_cache_type= @@global.query_cache_type; +SET @query_cache_limit= @@global.query_cache_limit; +SET @query_cache_min_res_unit= @@global.query_cache_min_res_unit; +SET @query_cache_size= @@global.query_cache_size; + +--echo # Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock +--echo # Establish connections user1,user2,user3 (user=root) +connect (user1,localhost,root,,test,,); +connect (user2,localhost,root,,test,,); +connect (user3,localhost,root,,test,,); + +--echo # Switch to connection user1 +connection user1; + +SET GLOBAL query_cache_type=1; +SET GLOBAL query_cache_limit=10000; +SET GLOBAL query_cache_min_res_unit=0; +SET GLOBAL query_cache_size= 100000; + +FLUSH TABLES; +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); + +--echo # Switch to connection user2 +connection user2; +LOCK TABLE t2 WRITE; + +--echo # Switch to connection user1 +connection user1; +--echo # "send" the next select, "reap" the result later. +--echo # The select will be blocked by the write lock on the t1. +let $select_for_qc = +SELECT *, (SELECT COUNT(*) FROM t2) FROM t1; +send; +eval $select_for_qc; + +--echo # Switch to connection user3 +connection user3; +# Typical information_schema.processlist content sufficient sleep time +# ID USER COMMAND TIME STATE INFO +# .... +# 2 root Query 5 Locked SELECT *, (SELECT COUNT(*) FROM t2) FROM t1 +# .... +# XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +# The values marked with 'X' must be reached. +--echo # Poll till the select of connection user1 is blocked by the write lock on t1. +let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist +WHERE state = 'Locked' + AND info = '$select_for_qc'; +--source include/wait_condition.inc +eval +SELECT user,command,state,info FROM information_schema.processlist +WHERE state = 'Locked' + AND info = '$select_for_qc'; +INSERT INTO t1 VALUES (4); + +--echo # Switch to connection user2 +connection user2; +UNLOCK TABLES; + +--echo # Switch to connection user1 +connection user1; +# +# Since the lock ordering rule in thr_multi_lock depends on +# pointer values, from execution to execution we might have +# different lock order, and therefore, sometimes lock t1 and block +# on t2, and sometimes block on t2 right away. In the second case, +# the following insert succeeds, and only then this select can +# proceed, and we actually test nothing, as the very first select +# returns 4 rows right away. +# It's fine to have a test case that covers the problematic area +# at least once in a while. +--echo # Collecting ("reap") the result from the previously blocked select. +--echo # The printing of the result (varies between 3 and 4 rows) set has to be suppressed. +--disable_result_log +--reap +--enable_result_log + +--echo # Switch to connection user3 +connection user3; +--echo # The next select enforces that effects of "concurrent_inserts" like the +--echo # record with a = 4 is missing in result sets can no more happen. +SELECT 1 FROM t1 WHERE a = 4; + +--echo # Switch to connection user1 +connection user1; +--echo # The next result set must contain 4 rows. +# If not, we have a regression of Bug#28249 +eval $select_for_qc; +RESET QUERY CACHE; +eval $select_for_qc; + +DROP TABLE t1,t2; + +--echo # Switch to connection default + close connections user1,user2,user3 +connection default; +disconnect user1; +disconnect user2; +disconnect user3; + +SET GLOBAL query_cache_type= @query_cache_type; +SET GLOBAL query_cache_limit= @query_cache_limit; +SET GLOBAL query_cache_min_res_unit= @query_cache_min_res_unit; +SET GLOBAL query_cache_size= @query_cache_size; + + -- cgit v1.2.1 From ab4d8812f46374061d314b35f1358525b279de4d Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Sat, 29 Nov 2008 15:36:17 +0200 Subject: Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of requested column When the storage engine uses secondary keys clustered with the primary key MySQL was adding the primary key parts to each secondary key. In doing so it was not checking whether the index was on full columns and this resulted in the secondary keys being added to the list of covering keys even if they have partial columns. Fixed by not adding a primary key part to the list of columns that can be used for index read of the secondary keys when the primary key part is a partial key part. mysql-test/r/innodb_mysql.result: Bug #37742: test case mysql-test/t/innodb_mysql.test: Bug #37742: test case sql/table.cc: Bug #37742: don't add the primary key part to the list of covering key parts of a secondary key if it's a partial key part. --- mysql-test/r/innodb_mysql.result | 84 ++++++++++++++++++++++++++++++++++++++++ mysql-test/t/innodb_mysql.test | 36 +++++++++++++++++ sql/table.cc | 4 +- 3 files changed, 123 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 2c14b1f2385..a348c63ec81 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -1677,3 +1677,87 @@ select @@session.sql_log_bin, @@session.binlog_format, @@session.tx_isolation; CREATE TABLE t1 ( a INT ) ENGINE=InnoDB; INSERT INTO t1 VALUES(1); DROP TABLE t1; +CREATE TABLE foo (a int, b int, c char(10), +PRIMARY KEY (c(3)), +KEY b (b) +) engine=innodb; +CREATE TABLE foo2 (a int, b int, c char(10), +PRIMARY KEY (c), +KEY b (b) +) engine=innodb; +CREATE TABLE bar (a int, b int, c char(10), +PRIMARY KEY (c(3)), +KEY b (b) +) engine=myisam; +INSERT INTO foo VALUES +(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'), +(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe'); +INSERT INTO bar SELECT * FROM foo; +INSERT INTO foo2 SELECT * FROM foo; +EXPLAIN SELECT c FROM bar WHERE b>2;; +id 1 +select_type SIMPLE +table bar +type ALL +possible_keys b +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo WHERE b>2;; +id 1 +select_type SIMPLE +table foo +type ALL +possible_keys b +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo2 WHERE b>2;; +id 1 +select_type SIMPLE +table foo2 +type range +possible_keys b +key b +key_len 5 +ref NULL +rows 3 +Extra Using where; Using index +EXPLAIN SELECT c FROM bar WHERE c>2;; +id 1 +select_type SIMPLE +table bar +type ALL +possible_keys PRIMARY +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo WHERE c>2;; +id 1 +select_type SIMPLE +table foo +type ALL +possible_keys PRIMARY +key NULL +key_len NULL +ref NULL +rows 6 +Extra Using where +EXPLAIN SELECT c FROM foo2 WHERE c>2;; +id 1 +select_type SIMPLE +table foo2 +type index +possible_keys PRIMARY +key b +key_len 5 +ref NULL +rows 6 +Extra Using where; Using index +DROP TABLE foo, bar, foo2; diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index ed8de208474..06ebb079a1b 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -43,3 +43,39 @@ CREATE TABLE t1 ( a INT ) ENGINE=InnoDB; INSERT INTO t1 VALUES(1); DROP TABLE t1; +# +# Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of +# requested column +# + +CREATE TABLE foo (a int, b int, c char(10), + PRIMARY KEY (c(3)), + KEY b (b) +) engine=innodb; + +CREATE TABLE foo2 (a int, b int, c char(10), + PRIMARY KEY (c), + KEY b (b) +) engine=innodb; + +CREATE TABLE bar (a int, b int, c char(10), + PRIMARY KEY (c(3)), + KEY b (b) +) engine=myisam; + +INSERT INTO foo VALUES + (1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'), + (4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe'); + +INSERT INTO bar SELECT * FROM foo; +INSERT INTO foo2 SELECT * FROM foo; + +--query_vertical EXPLAIN SELECT c FROM bar WHERE b>2; +--query_vertical EXPLAIN SELECT c FROM foo WHERE b>2; +--query_vertical EXPLAIN SELECT c FROM foo2 WHERE b>2; + +--query_vertical EXPLAIN SELECT c FROM bar WHERE c>2; +--query_vertical EXPLAIN SELECT c FROM foo WHERE c>2; +--query_vertical EXPLAIN SELECT c FROM foo2 WHERE c>2; + +DROP TABLE foo, bar, foo2; diff --git a/sql/table.cc b/sql/table.cc index 89714e4e47e..1de47a48513 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1416,7 +1416,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, */ if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX) { - field->part_of_key= share->keys_in_use; + if (field->key_length() == key_part->length && + !(field->flags & BLOB_FLAG)) + field->part_of_key= share->keys_in_use; if (field->part_of_sortkey.is_set(key)) field->part_of_sortkey= share->keys_in_use; } -- cgit v1.2.1 From 90152c17334aaecae640691f24e441723bd84d28 Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Mon, 1 Dec 2008 09:32:07 +0100 Subject: Fix for Bug#36875: Problem was, that there some warnings has been written containing values, which were determined by the server depending on the os. The solution is to disable warnings in general. The check of the values only have been done for Linux and Windows. Now, the check has been changed to the check of ranges (not more concrete values) being near by the expected (set) values. --- .../suite/sys_vars/inc/sort_buffer_size_basic.inc | 86 +++++++------- .../sys_vars/r/sort_buffer_size_basic_32.result | 123 ++++++--------------- .../sys_vars/r/sort_buffer_size_basic_64.result | 119 ++++++-------------- 3 files changed, 111 insertions(+), 217 deletions(-) diff --git a/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc index 4dbae7c8847..10acf709386 100644 --- a/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc +++ b/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc @@ -17,9 +17,12 @@ # * Valid & Invalid values # # * Scope & Access method # # * Data Integrity # +# Modified: Horst Hunger, 2008-11-28 # +# disabled warnings as they contain the values of this variable, # +# modified the check of the value only checking a range. # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -29,7 +32,7 @@ ###################################################################### -# START OF sort_buffer_size TESTS # +# START OF sort_buffer_size TESTS # ###################################################################### @@ -37,65 +40,63 @@ # Save initial value # ############################################################# -# due to difference when running on Windows (bug filed) +# due to differences when running on Windows (bug filed) --source include/not_windows.inc +--disable_warnings + SET @start_global_value = @@global.sort_buffer_size; -SELECT @start_global_value; SET @start_session_value = @@session.sort_buffer_size; -SELECT @start_session_value; - --echo '#--------------------FN_DYNVARS_151_01-------------------------#' ###################################################################### -# Display the DEFAULT value of sort_buffer_size # +# Display the DEFAULT value of sort_buffer_size # ###################################################################### SET @@global.sort_buffer_size = 1000; SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116; +SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; SET @@session.sort_buffer_size = 2000; SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116; +SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; --echo '#--------------------FN_DYNVARS_151_02-------------------------#' ###################################################################### -# Check the DEFAULT value of sort_buffer_size # +# Check the DEFAULT value of sort_buffer_size # ###################################################################### SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116; +SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116; +SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; --echo '#--------------------FN_DYNVARS_151_03-------------------------#' ################################################################################ -# Change the value of sort_buffer_size to a valid value for GLOBAL Scope # +# Change the value of sort_buffer_size to a valid value for GLOBAL Scope # ################################################################################ SET @@global.sort_buffer_size = 32776; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; SET @@global.sort_buffer_size = 32777; -SELECT @@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804; +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; SET @@global.sort_buffer_size = 4294967294; SELECT @@global.sort_buffer_size; ---echo 'Bug# 34877: Invalid Values are showing in variable on assigning valid values.'; --echo '#--------------------FN_DYNVARS_151_04-------------------------#' ################################################################################### -# Change the value of sort_buffer_size to a valid value for SESSION Scope # +# Change the value of sort_buffer_size to a valid value for SESSION Scope # ################################################################################### SET @@session.sort_buffer_size = 32776; -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; SET @@session.sort_buffer_size = 32777; -SELECT @@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804; +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; SET @@session.sort_buffer_size = 4294967294; @@ -104,13 +105,13 @@ SELECT @@session.sort_buffer_size; --echo '#------------------FN_DYNVARS_151_05-----------------------#' ################################################################## -# Change the value of sort_buffer_size to an invalid value # +# Change the value of sort_buffer_size to an invalid value # ################################################################## SET @@global.sort_buffer_size = 32775; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; SET @@global.sort_buffer_size = -1024; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; SET @@global.sort_buffer_size = 4294967296; SELECT @@global.sort_buffer_size; --Error ER_PARSE_ERROR @@ -121,19 +122,16 @@ SET @@global.sort_buffer_size = test; SELECT @@global.sort_buffer_size; SET @@session.sort_buffer_size = 32775; -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; SET @@session.sort_buffer_size = -2; -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; --Error ER_PARSE_ERROR SET @@session.sort_buffer_size = 65530.34.; SET @@session.sort_buffer_size = 4294967296; SELECT @@session.sort_buffer_size; ---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; --Error ER_WRONG_TYPE_FOR_VAR SET @@session.sort_buffer_size = test; -SELECT @@session.sort_buffer_size; - --echo '#------------------FN_DYNVARS_151_06-----------------------#' #################################################################### @@ -141,14 +139,16 @@ SELECT @@session.sort_buffer_size; #################################################################### -SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM + INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; --echo '#------------------FN_DYNVARS_151_07-----------------------#' #################################################################### # Check if the value in SESSION Table matches value in variable # #################################################################### -SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM + INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; --echo '#------------------FN_DYNVARS_151_08-----------------------#' @@ -157,25 +157,22 @@ SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSI #################################################################### SET @@global.sort_buffer_size = TRUE; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; SET @@global.sort_buffer_size = FALSE; -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -echo 'Bug: Errors should be displayed on assigning TRUE/FALSE to variable'; - +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; --echo '#---------------------FN_DYNVARS_151_09----------------------#' #################################################################################### -# Check if accessing variable with and without GLOBAL point to same variable # +# Check if accessing variable with and without GLOBAL point to same variable # #################################################################################### SET @@global.sort_buffer_size = 9000; SELECT @@sort_buffer_size = @@global.sort_buffer_size; - --echo '#---------------------FN_DYNVARS_151_10----------------------#' -######################################################################################################## -# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # -######################################################################################################## +################################################################################################### +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable# +################################################################################################### SET @@sort_buffer_size = 9000; SELECT @@sort_buffer_size = @@local.sort_buffer_size; @@ -184,12 +181,11 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; --echo '#---------------------FN_DYNVARS_151_11----------------------#' ################################################################################### -# Check if sort_buffer_size can be accessed with and without @@ sign # +# Check if sort_buffer_size can be accessed with and without @@ sign # ################################################################################### SET sort_buffer_size = 9100; -SELECT @sort_buffer_size= 32776 OR @@sort_buffer_size= 32804; -SELECT @@sort_buffer_size; +SELECT @@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000; --Error ER_UNKNOWN_TABLE SELECT local.sort_buffer_size; --Error ER_UNKNOWN_TABLE @@ -203,11 +199,11 @@ SELECT sort_buffer_size = @@session.sort_buffer_size; #################################### SET @@global.sort_buffer_size = @start_global_value; -SELECT @@global.sort_buffer_size; SET @@session.sort_buffer_size = @start_session_value; -SELECT @@session.sort_buffer_size; +--enable_warnings ############################################################# -# END OF sort_buffer_size TESTS # +# END OF sort_buffer_size TESTS # ############################################################# + diff --git a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result index 09a1fe59046..353ea9dee8c 100644 --- a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result @@ -1,47 +1,33 @@ SET @start_global_value = @@global.sort_buffer_size; -SELECT @start_global_value; -@start_global_value -262144 SET @start_session_value = @@session.sort_buffer_size; -SELECT @start_session_value; -@start_session_value -262144 '#--------------------FN_DYNVARS_151_01-------------------------#' SET @@global.sort_buffer_size = 1000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '1000' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116; -@@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116 +SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; +@@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000 1 SET @@session.sort_buffer_size = 2000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '2000' SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116; -@@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116 +SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; +@@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000 1 '#--------------------FN_DYNVARS_151_02-------------------------#' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116; -@@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116 +SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; +@@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000 1 SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116; -@@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116 +SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; +@@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000 1 '#--------------------FN_DYNVARS_151_03-------------------------#' SET @@global.sort_buffer_size = 32776; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32776' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = 32777; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32777' -SELECT @@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; @@ -51,19 +37,14 @@ SET @@global.sort_buffer_size = 4294967294; SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967294 -'Bug# 34877: Invalid Values are showing in variable on assigning valid values.'; '#--------------------FN_DYNVARS_151_04-------------------------#' SET @@session.sort_buffer_size = 32776; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32776' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 1 SET @@session.sort_buffer_size = 32777; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32777' -SELECT @@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 1 SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; @@ -75,20 +56,14 @@ SELECT @@session.sort_buffer_size; 4294967294 '#------------------FN_DYNVARS_151_05-----------------------#' SET @@global.sort_buffer_size = 32775; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32775' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = -1024; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = 4294967296; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '4294967296' SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967295 @@ -103,64 +78,47 @@ SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967295 SET @@session.sort_buffer_size = 32775; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32775' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 1 SET @@session.sort_buffer_size = -2; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 1 SET @@session.sort_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 SET @@session.sort_buffer_size = 4294967296; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '4294967296' SELECT @@session.sort_buffer_size; @@session.sort_buffer_size 4294967295 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@session.sort_buffer_size = test; ERROR 42000: Incorrect argument type to variable 'sort_buffer_size' -SELECT @@session.sort_buffer_size; -@@session.sort_buffer_size -4294967295 '#------------------FN_DYNVARS_151_06-----------------------#' -SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; @@global.sort_buffer_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_151_07-----------------------#' -SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; @@session.sort_buffer_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_151_08-----------------------#' SET @@global.sort_buffer_size = TRUE; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '1' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = FALSE; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 -'Bug: Errors should be displayed on assigning TRUE/FALSE to variable' '#---------------------FN_DYNVARS_151_09----------------------#' SET @@global.sort_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9000' SELECT @@sort_buffer_size = @@global.sort_buffer_size; @@sort_buffer_size = @@global.sort_buffer_size 0 '#---------------------FN_DYNVARS_151_10----------------------#' SET @@sort_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9000' SELECT @@sort_buffer_size = @@local.sort_buffer_size; @@sort_buffer_size = @@local.sort_buffer_size 1 @@ -169,14 +127,9 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; 1 '#---------------------FN_DYNVARS_151_11----------------------#' SET sort_buffer_size = 9100; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9100' -SELECT @sort_buffer_size= 32776 OR @@sort_buffer_size= 32804; -@sort_buffer_size= 32776 OR @@sort_buffer_size= 32804 -1 -SELECT @@sort_buffer_size; -@@sort_buffer_size -32804 +SELECT @@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000; +@@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000 +1 SELECT local.sort_buffer_size; ERROR 42S02: Unknown table 'local' in field list SELECT session.sort_buffer_size; @@ -184,10 +137,4 @@ ERROR 42S02: Unknown table 'session' in field list SELECT sort_buffer_size = @@session.sort_buffer_size; ERROR 42S22: Unknown column 'sort_buffer_size' in 'field list' SET @@global.sort_buffer_size = @start_global_value; -SELECT @@global.sort_buffer_size; -@@global.sort_buffer_size -262144 SET @@session.sort_buffer_size = @start_session_value; -SELECT @@session.sort_buffer_size; -@@session.sort_buffer_size -262144 diff --git a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result index e9bd14abc67..3708f88f889 100644 --- a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result +++ b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result @@ -1,47 +1,33 @@ SET @start_global_value = @@global.sort_buffer_size; -SELECT @start_global_value; -@start_global_value -262144 SET @start_session_value = @@session.sort_buffer_size; -SELECT @start_session_value; -@start_session_value -262144 '#--------------------FN_DYNVARS_151_01-------------------------#' SET @@global.sort_buffer_size = 1000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '1000' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116; -@@global.sort_buffer_size= 2097144 OR @@global.sort_buffer_size= 2097116 +SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; +@@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000 1 SET @@session.sort_buffer_size = 2000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '2000' SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116; -@@session.sort_buffer_size= 2097144 OR @@session.sort_buffer_size= 2097116 +SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; +@@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000 1 '#--------------------FN_DYNVARS_151_02-------------------------#' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116; -@@global.sort_buffer_size = 2097144 OR @@global.sort_buffer_size= 2097116 +SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; +@@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000 1 SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116; -@@session.sort_buffer_size = 2097144 OR @@session.sort_buffer_size= 2097116 +SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; +@@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000 1 '#--------------------FN_DYNVARS_151_03-------------------------#' SET @@global.sort_buffer_size = 32776; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32776' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = 32777; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32777' -SELECT @@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32777 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; @@ -51,19 +37,14 @@ SET @@global.sort_buffer_size = 4294967294; SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967294 -'Bug# 34877: Invalid Values are showing in variable on assigning valid values.'; '#--------------------FN_DYNVARS_151_04-------------------------#' SET @@session.sort_buffer_size = 32776; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32776' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 1 SET @@session.sort_buffer_size = 32777; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32777' -SELECT @@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32777 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 1 SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; @@ -75,16 +56,12 @@ SELECT @@session.sort_buffer_size; 4294967294 '#------------------FN_DYNVARS_151_05-----------------------#' SET @@global.sort_buffer_size = 32775; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32775' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = -1024; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = 4294967296; SELECT @@global.sort_buffer_size; @@ -101,16 +78,12 @@ SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967296 SET @@session.sort_buffer_size = 32775; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '32775' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 1 SET @@session.sort_buffer_size = -2; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804; -@@session.sort_buffer_size= 32776 OR @@session.sort_buffer_size= 32804 +SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 1 SET @@session.sort_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 @@ -118,45 +91,34 @@ SET @@session.sort_buffer_size = 4294967296; SELECT @@session.sort_buffer_size; @@session.sort_buffer_size 4294967296 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@session.sort_buffer_size = test; ERROR 42000: Incorrect argument type to variable 'sort_buffer_size' -SELECT @@session.sort_buffer_size; -@@session.sort_buffer_size -4294967296 '#------------------FN_DYNVARS_151_06-----------------------#' -SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; @@global.sort_buffer_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_151_07-----------------------#' -SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM +INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; @@session.sort_buffer_size = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_151_08-----------------------#' SET @@global.sort_buffer_size = TRUE; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '1' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 SET @@global.sort_buffer_size = FALSE; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '0' -SELECT @@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804; -@@global.sort_buffer_size= 32776 OR @@global.sort_buffer_size= 32804 +SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 1 -'Bug: Errors should be displayed on assigning TRUE/FALSE to variable' '#---------------------FN_DYNVARS_151_09----------------------#' SET @@global.sort_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9000' SELECT @@sort_buffer_size = @@global.sort_buffer_size; @@sort_buffer_size = @@global.sort_buffer_size 0 '#---------------------FN_DYNVARS_151_10----------------------#' SET @@sort_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9000' SELECT @@sort_buffer_size = @@local.sort_buffer_size; @@sort_buffer_size = @@local.sort_buffer_size 1 @@ -165,14 +127,9 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; 1 '#---------------------FN_DYNVARS_151_11----------------------#' SET sort_buffer_size = 9100; -Warnings: -Warning 1292 Truncated incorrect sort_buffer_size value: '9100' -SELECT @sort_buffer_size= 32776 OR @@sort_buffer_size= 32804; -@sort_buffer_size= 32776 OR @@sort_buffer_size= 32804 -1 -SELECT @@sort_buffer_size; -@@sort_buffer_size -32804 +SELECT @@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000; +@@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000 +1 SELECT local.sort_buffer_size; ERROR 42S02: Unknown table 'local' in field list SELECT session.sort_buffer_size; @@ -180,10 +137,4 @@ ERROR 42S02: Unknown table 'session' in field list SELECT sort_buffer_size = @@session.sort_buffer_size; ERROR 42S22: Unknown column 'sort_buffer_size' in 'field list' SET @@global.sort_buffer_size = @start_global_value; -SELECT @@global.sort_buffer_size; -@@global.sort_buffer_size -262144 SET @@session.sort_buffer_size = @start_session_value; -SELECT @@session.sort_buffer_size; -@@session.sort_buffer_size -262144 -- cgit v1.2.1 From bf1e54777972ff48122ee7bd2f33681e42f52a25 Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Tue, 2 Dec 2008 11:05:56 +0100 Subject: Fix for Bug#36876: The minimum value differs depending on the OS and mysqld build, so that the test fail spradically. The check of this value has been changed from check of concrete values to the check of a range that is near by the expected value. --- mysql-test/include/linux_sys_vars.inc | 1 - mysql-test/include/windows_sys_vars.inc | 1 - .../suite/sys_vars/inc/key_buffer_size_basic.inc | 54 +++++++++------------ .../sys_vars/r/key_buffer_size_basic_32.result | 55 +++++++++------------- .../sys_vars/r/key_buffer_size_basic_64.result | 55 +++++++++------------- 5 files changed, 68 insertions(+), 98 deletions(-) diff --git a/mysql-test/include/linux_sys_vars.inc b/mysql-test/include/linux_sys_vars.inc index 4401a1e057a..85d7c6df7dc 100644 --- a/mysql-test/include/linux_sys_vars.inc +++ b/mysql-test/include/linux_sys_vars.inc @@ -9,7 +9,6 @@ SET @min_flush_time = 0; #SET @max_flush_time = 0; SET @default_key_buffer_size = 131072; -SET @min_key_buffer_size = 36; #SET @default_join_buffer_size = 131072; #SET @min_join_buffer_size = 8200; diff --git a/mysql-test/include/windows_sys_vars.inc b/mysql-test/include/windows_sys_vars.inc index 90ff86fefd1..1d51ddb52f9 100644 --- a/mysql-test/include/windows_sys_vars.inc +++ b/mysql-test/include/windows_sys_vars.inc @@ -9,7 +9,6 @@ SET @min_flush_time = 0; #SET @max_flush_time = 0; SET @default_key_buffer_size= 131072; -SET @min_key_buffer_size= 8; #SET @default_join_buffer_size = 131072; #SET @min_join_buffer_size = 8200; diff --git a/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc index 996a9e712f9..a8fa50a6a23 100644 --- a/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc +++ b/mysql-test/suite/sys_vars/inc/key_buffer_size_basic.inc @@ -17,14 +17,14 @@ # * Valid & Invalid values # # * Scope & Access method # # * Data Integrity # +# Modified: Horst Hunger 2008-11-27 # +# Due to OS depending values the check has been changed # +# from concrete values to ranges. # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### -# Changes: # -# 2008-03-06 hhunger Got "lost connections with 5.1.24 # -######################################################################## --source include/load_sysvars.inc @@ -38,8 +38,6 @@ ######################################################################## SET @start_value = @@global.key_buffer_size; -SELECT @start_value; - --echo '#--------------------FN_DYNVARS_055_01------------------------#' ######################################################################## @@ -49,9 +47,7 @@ SELECT @start_value; SET @@global.key_buffer_size = 99; --Error ER_NO_DEFAULT SET @@global.key_buffer_size = DEFAULT; ---echo 'Bug# 34878: This variable has default value according to documentation'; -SELECT @@global.key_buffer_size = @min_key_buffer_size; - +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --echo '#---------------------FN_DYNVARS_055_02-------------------------#' ############################################### @@ -66,26 +62,25 @@ SELECT @@global.key_buffer_size = @start_value; # Change the value of key_buffer_size to a valid value # ######################################################################## -SET @@global.key_buffer_size = @min_key_buffer_size; -SELECT @@global.key_buffer_size= @min_key_buffer_size; +SET @@global.key_buffer_size = 8 ; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --disable_warnings -#Due to "lost connection" +#Due to increasing the runtime significantly and allocating the buffer instantly. #SET @@global.key_buffer_size = 4294967295; --enable_warnings #SELECT @@global.key_buffer_size; SET @@global.key_buffer_size = 1800; -SELECT @@global.key_buffer_size = @min_key_buffer_size; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SET @@global.key_buffer_size = 65535; SELECT @@global.key_buffer_size; -echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; - --echo '#--------------------FN_DYNVARS_055_04-------------------------#' ########################################################################### # Change the value of key_buffer_size to invalid value # ########################################################################### -# Due to "lost connection" +# Due to increasing the runtime significantly and allocating the buffer instantly +# with a size of 18446744073709551615 bytes with 32bit exec. #SET @@global.key_buffer_size = -1; #SELECT @@global.key_buffer_size; #SET @@global.key_buffer_size = 100000000000; @@ -96,16 +91,14 @@ SELECT @@global.key_buffer_size; #SET @@global.key_buffer_size = -1024; #SELECT @@global.key_buffer_size; SET @@global.key_buffer_size = 4; -SELECT @@global.key_buffer_size = @min_key_buffer_size; ---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --Error ER_WRONG_TYPE_FOR_VAR SET @@global.key_buffer_size = ON; -SELECT @@global.key_buffer_size = @min_key_buffer_size; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --Error ER_WRONG_TYPE_FOR_VAR SET @@global.key_buffer_size = 'test'; -SELECT @@global.key_buffer_size = @min_key_buffer_size; - +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --echo '#-------------------FN_DYNVARS_055_05----------------------------#' ########################################################################### @@ -114,8 +107,7 @@ SELECT @@global.key_buffer_size = @min_key_buffer_size; --Error ER_GLOBAL_VARIABLE SET @@session.key_buffer_size = 0; -SELECT @@key_buffer_size = @min_key_buffer_size; - +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --echo '#----------------------FN_DYNVARS_055_06------------------------#' ############################################################################## @@ -130,17 +122,15 @@ SELECT @@key_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='key_buffer_size'; - --echo '#---------------------FN_DYNVARS_055_07----------------------#' ################################################################### # Check if TRUE and FALSE values can be used on variable # ################################################################### SET @@global.key_buffer_size = TRUE; -SELECT @@global.key_buffer_size = @min_key_buffer_size; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; SET @@global.key_buffer_size = FALSE; -SELECT @@global.key_buffer_size = @min_key_buffer_size; - +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --echo '#---------------------FN_DYNVARS_055_08----------------------#' ##################################################################### @@ -150,7 +140,7 @@ SELECT @@global.key_buffer_size = @min_key_buffer_size; # due to differences in contents of the warnings --disable_warnings -SET @@global.key_buffer_size = @min_key_buffer_size; +SET @@global.key_buffer_size = 8 ; SELECT @@key_buffer_size = @@global.key_buffer_size; --enable_warnings @@ -160,8 +150,8 @@ SELECT @@key_buffer_size = @@global.key_buffer_size; ########################################################################## --Error ER_GLOBAL_VARIABLE -SET key_buffer_size = @min_key_buffer_size; -SELECT @@key_buffer_size = @min_key_buffer_size; +SET key_buffer_size = 8 ; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; --Error ER_PARSE_ERROR SET local.key_buffer_size = 10; --Error ER_UNKNOWN_TABLE @@ -179,9 +169,9 @@ SELECT key_buffer_size = @@session.key_buffer_size; ############################## SET @@global.key_buffer_size = @start_value; -SELECT @@global.key_buffer_size; --enable_warnings ####################################################################### # END OF key_buffer_size TESTS # ####################################################################### + diff --git a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result index 981988a1d4d..51c4f841205 100644 --- a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result @@ -1,14 +1,10 @@ SET @start_value = @@global.key_buffer_size; -SELECT @start_value; -@start_value -1048576 '#--------------------FN_DYNVARS_055_01------------------------#' SET @@global.key_buffer_size = 99; SET @@global.key_buffer_size = DEFAULT; ERROR 42000: Variable 'key_buffer_size' doesn't have a default value -'Bug# 34878: This variable has default value according to documentation'; -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#---------------------FN_DYNVARS_055_02-------------------------#' SET @@global.key_buffer_size = @start_value; @@ -16,21 +12,20 @@ SELECT @@global.key_buffer_size = @start_value; @@global.key_buffer_size = @start_value 1 '#--------------------FN_DYNVARS_055_03------------------------#' -SET @@global.key_buffer_size = @min_key_buffer_size; -SELECT @@global.key_buffer_size= @min_key_buffer_size; -@@global.key_buffer_size= @min_key_buffer_size +SET @@global.key_buffer_size = 8 ; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 1800; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '1800' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 65535; SELECT @@global.key_buffer_size; @@global.key_buffer_size 61440 -'Bug # 34837: Errors are not coming on assigning invalid values to variable' '#--------------------FN_DYNVARS_055_04-------------------------#' SET @@global.key_buffer_size = 10000.01; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' @@ -40,25 +35,24 @@ SELECT @@global.key_buffer_size; SET @@global.key_buffer_size = 4; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '4' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.key_buffer_size = ON; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 'test'; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#-------------------FN_DYNVARS_055_05----------------------------#' SET @@session.key_buffer_size = 0; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@key_buffer_size = @min_key_buffer_size; -@@key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#----------------------FN_DYNVARS_055_06------------------------#' SELECT @@global.key_buffer_size = VARIABLE_VALUE @@ -75,25 +69,25 @@ WHERE VARIABLE_NAME='key_buffer_size'; SET @@global.key_buffer_size = TRUE; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '1' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = FALSE; Warnings: Warning 1438 Cannot drop default keycache -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#---------------------FN_DYNVARS_055_08----------------------#' -SET @@global.key_buffer_size = @min_key_buffer_size; +SET @@global.key_buffer_size = 8 ; SELECT @@key_buffer_size = @@global.key_buffer_size; @@key_buffer_size = @@global.key_buffer_size 1 '#---------------------FN_DYNVARS_055_09----------------------#' -SET key_buffer_size = @min_key_buffer_size; +SET key_buffer_size = 8 ; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@key_buffer_size = @min_key_buffer_size; -@@key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET local.key_buffer_size = 10; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size = 10' at line 1 @@ -106,6 +100,3 @@ ERROR 42S02: Unknown table 'global' in field list SELECT key_buffer_size = @@session.key_buffer_size; ERROR 42S22: Unknown column 'key_buffer_size' in 'field list' SET @@global.key_buffer_size = @start_value; -SELECT @@global.key_buffer_size; -@@global.key_buffer_size -1048576 diff --git a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result index 981988a1d4d..51c4f841205 100644 --- a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result +++ b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_64.result @@ -1,14 +1,10 @@ SET @start_value = @@global.key_buffer_size; -SELECT @start_value; -@start_value -1048576 '#--------------------FN_DYNVARS_055_01------------------------#' SET @@global.key_buffer_size = 99; SET @@global.key_buffer_size = DEFAULT; ERROR 42000: Variable 'key_buffer_size' doesn't have a default value -'Bug# 34878: This variable has default value according to documentation'; -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#---------------------FN_DYNVARS_055_02-------------------------#' SET @@global.key_buffer_size = @start_value; @@ -16,21 +12,20 @@ SELECT @@global.key_buffer_size = @start_value; @@global.key_buffer_size = @start_value 1 '#--------------------FN_DYNVARS_055_03------------------------#' -SET @@global.key_buffer_size = @min_key_buffer_size; -SELECT @@global.key_buffer_size= @min_key_buffer_size; -@@global.key_buffer_size= @min_key_buffer_size +SET @@global.key_buffer_size = 8 ; +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 1800; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '1800' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 65535; SELECT @@global.key_buffer_size; @@global.key_buffer_size 61440 -'Bug # 34837: Errors are not coming on assigning invalid values to variable' '#--------------------FN_DYNVARS_055_04-------------------------#' SET @@global.key_buffer_size = 10000.01; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' @@ -40,25 +35,24 @@ SELECT @@global.key_buffer_size; SET @@global.key_buffer_size = 4; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '4' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.key_buffer_size = ON; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = 'test'; ERROR 42000: Incorrect argument type to variable 'key_buffer_size' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#-------------------FN_DYNVARS_055_05----------------------------#' SET @@session.key_buffer_size = 0; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@key_buffer_size = @min_key_buffer_size; -@@key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#----------------------FN_DYNVARS_055_06------------------------#' SELECT @@global.key_buffer_size = VARIABLE_VALUE @@ -75,25 +69,25 @@ WHERE VARIABLE_NAME='key_buffer_size'; SET @@global.key_buffer_size = TRUE; Warnings: Warning 1292 Truncated incorrect key_buffer_size value: '1' -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET @@global.key_buffer_size = FALSE; Warnings: Warning 1438 Cannot drop default keycache -SELECT @@global.key_buffer_size = @min_key_buffer_size; -@@global.key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 '#---------------------FN_DYNVARS_055_08----------------------#' -SET @@global.key_buffer_size = @min_key_buffer_size; +SET @@global.key_buffer_size = 8 ; SELECT @@key_buffer_size = @@global.key_buffer_size; @@key_buffer_size = @@global.key_buffer_size 1 '#---------------------FN_DYNVARS_055_09----------------------#' -SET key_buffer_size = @min_key_buffer_size; +SET key_buffer_size = 8 ; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL -SELECT @@key_buffer_size = @min_key_buffer_size; -@@key_buffer_size = @min_key_buffer_size +SELECT @@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36; +@@global.key_buffer_size >= 8 AND @@global.key_buffer_size <= 36 1 SET local.key_buffer_size = 10; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size = 10' at line 1 @@ -106,6 +100,3 @@ ERROR 42S02: Unknown table 'global' in field list SELECT key_buffer_size = @@session.key_buffer_size; ERROR 42S22: Unknown column 'key_buffer_size' in 'field list' SET @@global.key_buffer_size = @start_value; -SELECT @@global.key_buffer_size; -@@global.key_buffer_size -1048576 -- cgit v1.2.1 From 6538f19f9a73c1102f4ca240bda6aa58799aba6b Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 2 Dec 2008 11:18:01 +0100 Subject: Bug#40389: REORGANIZE PARTITION crashes when only using one partition The non documented command 'ALTER PARTITION t REORGANIZE PARTITION' (without any partitions!) which only make sense for nativly partitioned engines, such as NDB, crashes the server if there was no change of number of partitions. The problem was wrong usage of fast_end_partition function, which led to usage of a non initialized variable. mysql-test/r/partition_mgm.result: Bug#40389: REORGANIZE PARTITION crashes when only using one partition Updated test result. mysql-test/t/partition_mgm.test: Bug#40389: REORGANIZE PARTITION crashes when only using one partition Added new test case. sql/partition_info.cc: Bug#40389: REORGANIZE PARTITION crashes when only using one partition Added DBUG_ASSERT to easier catch similar problems. sql/sql_partition.cc: Bug#40389: REORGANIZE PARTITION crashes when only using one partition fast_end_partitions is called later in mysql_alter_table if variable fast_alter_partition is set. --- mysql-test/r/partition_mgm.result | 7 +++++++ mysql-test/t/partition_mgm.test | 11 +++++++++++ sql/partition_info.cc | 1 + sql/sql_partition.cc | 5 ++--- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/partition_mgm.result b/mysql-test/r/partition_mgm.result index 9ef220028b3..eeb9be949a0 100644 --- a/mysql-test/r/partition_mgm.result +++ b/mysql-test/r/partition_mgm.result @@ -1,4 +1,11 @@ DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT PRIMARY KEY) +ENGINE MYISAM +PARTITION BY HASH (a) +PARTITIONS 1; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +ALTER TABLE t1 REORGANIZE PARTITION; +DROP TABLE t1; create table t1 (a int) partition by range (a) subpartition by key (a) diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test index 68da4a5b390..1f53989b4d4 100644 --- a/mysql-test/t/partition_mgm.test +++ b/mysql-test/t/partition_mgm.test @@ -3,6 +3,17 @@ DROP TABLE IF EXISTS t1; --enable_warnings +# +# Bug 40389: REORGANIZE PARTITION crashes when only using one partition +# +CREATE TABLE t1 (a INT PRIMARY KEY) +ENGINE MYISAM +PARTITION BY HASH (a) +PARTITIONS 1; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +ALTER TABLE t1 REORGANIZE PARTITION; +DROP TABLE t1; + # # Bug 21143: mysqld hang when error in number of subparts in # REORGANIZE command diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 02f2c9b0ab1..e2027d3571e 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -867,6 +867,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, if (part_type != HASH_PARTITION || !list_of_part_fields) { + DBUG_ASSERT(part_expr); err= part_expr->walk(&Item::check_partition_func_processor, 0, NULL); if (!err && is_sub_partitioned() && !list_of_subpart_fields) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index da80a2125e9..6fb803ce4ff 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4228,9 +4228,8 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, after the change as before. Thus we can reply ok immediately without any changes at all. */ - DBUG_RETURN(fast_end_partition(thd, ULL(0), ULL(0), - table, NULL, - TRUE, NULL, FALSE)); + *fast_alter_partition= TRUE; + DBUG_RETURN(FALSE); } else if (new_part_no > curr_part_no) { -- cgit v1.2.1 From 7ed2caed5843abdab9d664e2dafba83b1a1cfb96 Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Tue, 2 Dec 2008 12:34:52 +0100 Subject: Fix for Bug#37810: The "show status" may be received by the server in a startup state, where it only can reject the statement, so that the client then react with 2013. So, adding 2013 to the list of errors may help, as the "show status" will be repeated then. --- mysql-test/include/wait_until_connected_again.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index dc96f646cb3..2d8356cb0f5 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -6,7 +6,7 @@ let $counter= 500; while ($mysql_errno) { - --error 0,2002,2006 + --error 0,2002,2006,2013 show status; dec $counter; -- cgit v1.2.1 From 8ebce5350e1d3f7d51152324bb8b1b6e09d5a6d6 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Tue, 2 Dec 2008 19:32:07 +0200 Subject: Bug #40221 Replication failure on RBR + UPDATE the primary key A transaction could result in having an extra event after a query that errored e.g because of a dup key. Such a query is rolled back in innodb, as specified, but has not been in binlog. It appeares that the binlog engine did not always register for a query (statement) because the previous query had not reset at its statement commit time. Because of that fact there was no roll-back to the trx_data->before_stmt_pos position and a the pending event of the errorred query could become flushed to the binlog file. Fixed with deploying the reset of trx_data->before_stmt_pos at the end of the query processing. mysql-test/suite/binlog/r/binlog_innodb_row.result: a new test file to contain tests dealing with binlogging innodb with the row-based format. mysql-test/suite/binlog/t/binlog_innodb_row.test: a new test file to contain tests dealing with binlogging innodb with the row-based format. sql/log.cc: Flushing the pending row event at binlog_end_trans() is moved down to the commit branch. Resetting of trx_data->before_stmt_pos to the uninitialized value at the end of the statement is implemented in binlog_commit() and binlog_rollback(). Asserting emptiness the transaction cache after reset() and the uninitilized value for the statement's savepoint binlog position. --- mysql-test/suite/binlog/r/binlog_innodb_row.result | 22 ++++++++++++++++++ mysql-test/suite/binlog/t/binlog_innodb_row.test | 26 ++++++++++++++++++++++ sql/log.cc | 18 ++++++++++----- 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 mysql-test/suite/binlog/r/binlog_innodb_row.result create mode 100644 mysql-test/suite/binlog/t/binlog_innodb_row.test diff --git a/mysql-test/suite/binlog/r/binlog_innodb_row.result b/mysql-test/suite/binlog/r/binlog_innodb_row.result new file mode 100644 index 00000000000..47ddcbd00f6 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_innodb_row.result @@ -0,0 +1,22 @@ +CREATE TABLE t1 (pk int auto_increment primary key) ENGINE=innodb; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`pk`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +reset master; +begin; +insert into t1 values (1),(2); +*** the following UPDATE query wont generate any updates for the binlog *** +update t1 set pk = 3 where pk < 3; +ERROR 23000: Duplicate entry '3' for key 'PRIMARY' +commit; +*** Results of the test: the binlog must have only Write_rows events not any Update_rows *** +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +drop table t1; diff --git a/mysql-test/suite/binlog/t/binlog_innodb_row.test b/mysql-test/suite/binlog/t/binlog_innodb_row.test new file mode 100644 index 00000000000..7f42f5b95cb --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_innodb_row.test @@ -0,0 +1,26 @@ +# +# Tests of innodb/binlog with the row binlog format +# +source include/have_innodb.inc; +source include/have_log_bin.inc; +source include/have_binlog_format_row.inc; + +# +# Bug #40221 Replication failure on RBR + UPDATE the primary key +# + +CREATE TABLE t1 (pk int auto_increment primary key) ENGINE=innodb; +show create table t1; +reset master; + +begin; +insert into t1 values (1),(2); +--echo *** the following UPDATE query wont generate any updates for the binlog *** +--error ER_DUP_ENTRY +update t1 set pk = 3 where pk < 3; +commit; + +--echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows *** +source include/show_binlog_events.inc; + +drop table t1; diff --git a/sql/log.cc b/sql/log.cc index fb8669a5731..8169ff08590 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -207,6 +207,7 @@ public: truncate(0); before_stmt_pos= MY_OFF_T_UNDEF; trans_log.end_of_file= max_binlog_cache_size; + DBUG_ASSERT(empty()); } Rows_log_event *pending() const @@ -1377,8 +1378,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), FLAGSTR(thd->options, OPTION_BEGIN))); - thd->binlog_flush_pending_rows_event(TRUE); - /* NULL denotes ROLLBACK with nothing to replicate: i.e., rollback of only transactional tables. If the transaction contain changes to @@ -1387,6 +1386,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, */ if (end_ev != NULL) { + thd->binlog_flush_pending_rows_event(TRUE); /* Doing a commit or a rollback including non-transactional tables, i.e., ending a transaction where we might write the transaction @@ -1435,6 +1435,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, mysql_bin_log.update_table_map_version(); } + DBUG_ASSERT(thd->binlog_get_pending_rows_event() == NULL); DBUG_RETURN(error); } @@ -1466,6 +1467,7 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all) */ static int binlog_commit(handlerton *hton, THD *thd, bool all) { + int error= 0; DBUG_ENTER("binlog_commit"); binlog_trx_data *const trx_data= (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton); @@ -1552,10 +1554,14 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) { Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) - int error= binlog_end_trans(thd, trx_data, &qev, all); - DBUG_RETURN(error); + error= binlog_end_trans(thd, trx_data, &qev, all); + goto end; } - DBUG_RETURN(0); + +end: + if (!all) + trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit + DBUG_RETURN(error); } /** @@ -1615,6 +1621,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) */ error= binlog_end_trans(thd, trx_data, 0, all); } + if (!all) + trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt rollback DBUG_RETURN(error); } -- cgit v1.2.1 From 4d1a042df0c52fd7c721313ec84d39e2b2c0a2f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Dec 2008 05:11:48 +0100 Subject: Remove bashisms from BUILD/compile-dist and configure.in, so Bootstrap works on Solaris box; force GNU make in compile-dist; remove unportable "grep -q" from configure.in --- BUILD/compile-dist | 36 ++++++++++++++++++++++++++++-------- configure.in | 28 ++++++++++++++++------------ 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/BUILD/compile-dist b/BUILD/compile-dist index 613f2643c56..7c2dbe00dc5 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -15,30 +15,49 @@ autoconf (cd bdb/dist && sh s_all) (cd innobase && aclocal && autoheader && aclocal && automake && autoconf) +gmake= +for x in gmake gnumake make; do + if $x --version 2>/dev/null | grep GNU > /dev/null; then + gmake=$x + break; + fi +done + +if [ -z "$gmake" ]; then + # Our build may not depend on GNU make, but I wouldn't count on it + echo "Please install GNU make, and ensure it is in your path as gnumake, gmake, or make" >&2 + exit 2 +fi + # Default to gcc for CC and CXX if test -z "$CXX" ; then - export CXX=gcc + export CXX + CXX=gcc # Set some required compile options if test -z "$CXXFLAGS" ; then - export CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" + export CXXFLAGS + CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" fi fi if test -z "$CC" ; then - export CC=gcc + export CC + CC=gcc fi # Use ccache, if available if ccache -V > /dev/null 2>&1 then - if ! (echo "$CC" | grep "ccache" > /dev/null) + if echo "$CC" | grep -v ccache > /dev/null then - export CC="ccache $CC" + export CC + CC="ccache $CC" fi - if ! (echo "$CXX" | grep "ccache" > /dev/null) + if echo "$CXX" | grep -v ccache > /dev/null then - export CXX="ccache $CXX" + export CXX + CXX="ccache $CXX" fi fi @@ -50,4 +69,5 @@ fi --enable-thread-safe-client \ --with-extra-charsets=complex \ --with-ndbcluster -make + +$gmake diff --git a/configure.in b/configure.in index 83220a879f0..448d3c90a26 100644 --- a/configure.in +++ b/configure.in @@ -409,7 +409,7 @@ fi MYSQL_PROG_AR # libmysqlclient versioning when linked with GNU ld. -if $LD --version 2>/dev/null|grep -q GNU; then +if $LD --version 2>/dev/null|grep GNU > /dev/null; then LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver" AC_CONFIG_FILES(libmysql/libmysql.ver) fi @@ -437,11 +437,13 @@ dnl Find paths to some shell programs AC_PATH_PROG(LN, ln, ln) # This must be able to take a -f flag like normal unix ln. AC_PATH_PROG(LN_CP_F, ln, ln) -if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then -# If ln -f does not exists use -s (AFS systems) -if test -n "$LN_CP_F"; then - LN_CP_F="$LN_CP_F -s" -fi +if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then + : +else + # If ln -f does not exists use -s (AFS systems) + if test -n "$LN_CP_F"; then + LN_CP_F="$LN_CP_F -s" + fi fi AC_PATH_PROG(MV, mv, mv) @@ -1940,14 +1942,16 @@ MYSQL_CHECK_IN_ADDR_T # Do the c++ compiler have a bool type MYSQL_CXX_BOOL # Check some common bugs with gcc 2.8.# on sparc -if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then -MYSQL_CHECK_LONGLONG_TO_FLOAT -if test "$ac_cv_conv_longlong_to_float" != "yes" -then - AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! +if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then + : +else + MYSQL_CHECK_LONGLONG_TO_FLOAT + if test "$ac_cv_conv_longlong_to_float" != "yes" + then + AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try again]) -fi + fi fi AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include ]) AC_CHECK_TYPES([size_t], [], [], [#include ]) -- cgit v1.2.1 From 4d63306d42d51724b15b29d2379b1e7122ed987c Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Wed, 3 Dec 2008 10:39:31 +0100 Subject: temporary fix for Bug#37780: A short analysis of the test shows that it needs a replacement of the sleeps and as "In most cases, it might take some time for the thread to die, because the kill flag is checked only at specific intervals" (user manual) to carfully check that and insert waiting for that event. --- mysql-test/t/disabled.def | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index c01bb4b9e44..0ba5e353474 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -10,5 +10,6 @@ # ############################################################################## federated_transactions : Bug#29523 Transactions do not work -log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows -slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions +log_tables : Bug #37798: main.log_tables fails randomly on powermacg5 and windows +slow_query_log_func : Bug #37962: *_func tests containing sleeps/race conditions +kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enoiugh for pushbuild. -- cgit v1.2.1 From 120cfcacb865e3127f0d0a01d64d5e756774e35c Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Wed, 3 Dec 2008 16:43:53 +0100 Subject: (No) fix for Bug#36878: The test has been taken out fo main and put into "sys_vars", but the opportunity to check the test has been take to improve it. --- .../suite/sys_vars/inc/tmp_table_size_basic.inc | 30 +++------------------- .../sys_vars/r/tmp_table_size_basic_32.result | 6 ----- .../sys_vars/r/tmp_table_size_basic_64.result | 6 ----- 3 files changed, 3 insertions(+), 39 deletions(-) diff --git a/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc b/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc index 7f69bcd1f8c..d29ef6da094 100644 --- a/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc +++ b/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc @@ -18,8 +18,8 @@ # * Scope & Access method # # * Data Integrity # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_tmp_table_size # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### @@ -29,7 +29,6 @@ # START OF tmp_table_size TESTS # ############################################################## - ############################################################# # Save initial value # ############################################################# @@ -39,8 +38,6 @@ SELECT @start_global_value; SET @start_session_value = @@session.tmp_table_size; SELECT @start_session_value; ---echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; - --echo '#--------------------FN_DYNVARS_005_01-------------------------#' ############################################################## # Display the DEFAULT value of tmp_table_size # @@ -50,16 +47,13 @@ SET @@global.tmp_table_size = 100; SET @@global.tmp_table_size = DEFAULT; SELECT @@global.tmp_table_size; ---echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; SET @@session.tmp_table_size = 200; SET @@session.tmp_table_size = DEFAULT; SELECT @@session.tmp_table_size; ---echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; - --echo '#--------------------FN_DYNVARS_005_02-------------------------#' ######################################################################## -# Check the DEFAULT value of tmp_table_size # +# Check the DEFAULT value of tmp_table_size # ######################################################################## SET @@global.tmp_table_size = DEFAULT; @@ -68,8 +62,6 @@ SELECT @@global.tmp_table_size = 33554432; SET @@session.tmp_table_size = DEFAULT; SELECT @@session.tmp_table_size = 33554432; ---echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; - --echo '#--------------------FN_DYNVARS_005_03-------------------------#' ######################################################################## # Change the value of tmp_table_size to a valid value for GLOBAL Scope # @@ -111,24 +103,17 @@ SELECT @@global.tmp_table_size; SET @@global.tmp_table_size = 1000; SELECT @@global.tmp_table_size; ---echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; - - -- Error ER_WRONG_TYPE_FOR_VAR SET @@global.tmp_table_size = ON; - -- Error ER_WRONG_TYPE_FOR_VAR SET @@global.tmp_table_size = OFF; - SET @@global.tmp_table_size = True; SELECT @@global.tmp_table_size; SET @@global.tmp_table_size = False; SELECT @@global.tmp_table_size; ---echo 'Bug:Error should be shown that variable is numeric and can not assigned boolean value'; - -- Error ER_WRONG_TYPE_FOR_VAR SET @@global.tmp_table_size = 65530.34; @@ -136,11 +121,9 @@ SET @@global.tmp_table_size = 65530.34; -- Error ER_WRONG_TYPE_FOR_VAR SET @@global.tmp_table_size ="Test"; - -- Error ER_WRONG_TYPE_FOR_VAR SET @@session.tmp_table_size = ON; - -- Error ER_WRONG_TYPE_FOR_VAR SET @@session.tmp_table_size = OFF; @@ -156,13 +139,11 @@ SET @@session.tmp_table_size = "Test"; SET @@session.tmp_table_size = 12345678901; SELECT @@session.tmp_table_size; - --echo '#------------------FN_DYNVARS_005_06-----------------------#' #################################################################### # Check if the value in GLOBAL Table matches value in variable # #################################################################### - SELECT @@global.tmp_table_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='tmp_table_size'; @@ -176,9 +157,6 @@ SELECT @@session.tmp_table_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='tmp_table_size'; - - - --echo '#---------------------FN_DYNVARS_001_09----------------------#' ######################################################################## # Check if global and session variables are independent of each other # @@ -216,7 +194,6 @@ SELECT global.tmp_table_size; --Error ER_BAD_FIELD_ERROR SELECT tmp_table_size = @@session.tmp_table_size; - #################################### # Restore initial value # #################################### @@ -226,7 +203,6 @@ SELECT @@global.tmp_table_size; SET @@session.tmp_table_size = @start_session_value; SELECT @@session.tmp_table_size; - ################################################### # END OF tmp_table_size TESTS # ################################################### diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result index aeafd95ed55..ba3fd5420c6 100644 --- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result @@ -6,7 +6,6 @@ SET @start_session_value = @@session.tmp_table_size; SELECT @start_session_value; @start_session_value 16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; '#--------------------FN_DYNVARS_005_01-------------------------#' SET @@global.tmp_table_size = 100; Warnings: @@ -15,7 +14,6 @@ SET @@global.tmp_table_size = DEFAULT; SELECT @@global.tmp_table_size; @@global.tmp_table_size 16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; SET @@session.tmp_table_size = 200; Warnings: Warning 1292 Truncated incorrect tmp_table_size value: '200' @@ -23,7 +21,6 @@ SET @@session.tmp_table_size = DEFAULT; SELECT @@session.tmp_table_size; @@session.tmp_table_size 16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; '#--------------------FN_DYNVARS_005_02-------------------------#' SET @@global.tmp_table_size = DEFAULT; SELECT @@global.tmp_table_size = 33554432; @@ -33,7 +30,6 @@ SET @@session.tmp_table_size = DEFAULT; SELECT @@session.tmp_table_size = 33554432; @@session.tmp_table_size = 33554432 0 -'Bug# 34876: This variable has invalid default value as compared to documentation'; '#--------------------FN_DYNVARS_005_03-------------------------#' SET @@global.tmp_table_size = 1024; SELECT @@global.tmp_table_size; @@ -79,7 +75,6 @@ Warning 1292 Truncated incorrect tmp_table_size value: '1000' SELECT @@global.tmp_table_size; @@global.tmp_table_size 1024 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.tmp_table_size = ON; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@global.tmp_table_size = OFF; @@ -96,7 +91,6 @@ Warning 1292 Truncated incorrect tmp_table_size value: '0' SELECT @@global.tmp_table_size; @@global.tmp_table_size 1024 -'Bug:Error should be shown that variable is numeric and can not assigned boolean value'; SET @@global.tmp_table_size = 65530.34; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@global.tmp_table_size ="Test"; diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result index 837b90fc143..73ebaecf5f0 100644 --- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result +++ b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result @@ -6,7 +6,6 @@ SET @start_session_value = @@session.tmp_table_size; SELECT @start_session_value; @start_session_value 16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; '#--------------------FN_DYNVARS_005_01-------------------------#' SET @@global.tmp_table_size = 100; Warnings: @@ -15,7 +14,6 @@ SET @@global.tmp_table_size = DEFAULT; SELECT @@global.tmp_table_size; @@global.tmp_table_size 16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; SET @@session.tmp_table_size = 200; Warnings: Warning 1292 Truncated incorrect tmp_table_size value: '200' @@ -23,7 +21,6 @@ SET @@session.tmp_table_size = DEFAULT; SELECT @@session.tmp_table_size; @@session.tmp_table_size 16777216 -'Bug# 34876: This variable has invalid default value as compared to documentation'; '#--------------------FN_DYNVARS_005_02-------------------------#' SET @@global.tmp_table_size = DEFAULT; SELECT @@global.tmp_table_size = 33554432; @@ -33,7 +30,6 @@ SET @@session.tmp_table_size = DEFAULT; SELECT @@session.tmp_table_size = 33554432; @@session.tmp_table_size = 33554432 0 -'Bug# 34876: This variable has invalid default value as compared to documentation'; '#--------------------FN_DYNVARS_005_03-------------------------#' SET @@global.tmp_table_size = 1024; SELECT @@global.tmp_table_size; @@ -79,7 +75,6 @@ Warning 1292 Truncated incorrect tmp_table_size value: '1000' SELECT @@global.tmp_table_size; @@global.tmp_table_size 1024 -'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.tmp_table_size = ON; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@global.tmp_table_size = OFF; @@ -96,7 +91,6 @@ Warning 1292 Truncated incorrect tmp_table_size value: '0' SELECT @@global.tmp_table_size; @@global.tmp_table_size 1024 -'Bug:Error should be shown that variable is numeric and can not assigned boolean value'; SET @@global.tmp_table_size = 65530.34; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@global.tmp_table_size ="Test"; -- cgit v1.2.1 From 91f0c94c23eb9b48421d9590662666de9e4c75d5 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Wed, 3 Dec 2008 19:15:39 +0300 Subject: Fix for bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on windows. Visual Studio does not take into account some x86 hardware limitations which leads to incorrect results when converting large DOUBLE values to BIGINT UNSIGNED ones. Fixed by adding a workaround for double->ulonglong conversion on Windows. include/config-win.h: Added double2ulonglong(double) function implementing a workaround for broken double->ulonglong conversion on Windows/x86. include/my_global.h: Define double2ulonglong() as a simple typecast for anything but Windows. mysql-test/r/type_float.result: Added a test case for bug #27483. mysql-test/t/type_float.test: Added a test case for bug #27483. --- include/config-win.h | 9 +++++++++ include/my_global.h | 3 +++ mysql-test/r/type_float.result | 13 +++++++++++++ mysql-test/t/type_float.test | 17 +++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/include/config-win.h b/include/config-win.h index 2628095a181..eba699159c7 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -245,6 +245,15 @@ inline double ulonglong2double(ulonglong value) #define my_off_t2double(A) ulonglong2double(A) #endif /* _WIN64 */ +inline ulonglong double2ulonglong(double d) +{ + double t= d - (double) 0x8000000000000000ULL; + + if (t >= 0) + return ((ulonglong) t) + 0x8000000000000000ULL; + return (ulonglong) d; +} + #if SIZEOF_OFF_T > 4 #define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C)) #define tell(A) _telli64(A) diff --git a/include/my_global.h b/include/my_global.h index e474b620d27..845ae042a42 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -713,6 +713,9 @@ typedef SOCKET_SIZE_TYPE size_socket; #define ulonglong2double(A) ((double) (ulonglong) (A)) #define my_off_t2double(A) ((double) (my_off_t) (A)) #endif +#ifndef double2ulonglong +#define double2ulonglong(A) ((ulonglong) (double) (A)) +#endif #endif #ifndef offsetof diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index f1075604ca9..e7f17bd75a7 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -392,4 +392,17 @@ f1 + 0e0 1.0000000150475e+30 -1.0000000150475e+30 drop table t1; +create table t1(d double, u bigint unsigned); +insert into t1(d) values (9.2233720368547777e+18), +(9.223372036854779e18), +(9.22337203685479e18), +(1.84e19); +update t1 set u = d; +select * from t1; +d u +9.22337203685478e+18 9223372036854775808 +9.22337203685478e+18 9223372036854779904 +9.22337203685479e+18 9223372036854790144 +1.84e+19 18400000000000000000 +drop table t1; End of 5.0 tests diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 9aa8c00d24a..b23755b44fb 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -252,4 +252,21 @@ insert into t1 values (2e30), (-2e30); select f1 + 0e0 from t1; drop table t1; +# +# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on +# windows. +# + +create table t1(d double, u bigint unsigned); + +insert into t1(d) values (9.2233720368547777e+18), + (9.223372036854779e18), + (9.22337203685479e18), + (1.84e19); + +update t1 set u = d; +select * from t1; + +drop table t1; + --echo End of 5.0 tests -- cgit v1.2.1 From 43e9d5b3d561e980b41e7ebea1fc09b3ad700c74 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Wed, 3 Dec 2008 20:55:49 +0100 Subject: Bug #40116: Uncommited changes are replicated and stay on slave after rollback on master When starting a transaction with a statement containing changes to both transactional tables and non-transactional tables, the statement is considered as non-transactional and is therefore written directly to the binary log. This behaviour was present in 5.0, and has propagated to 5.1. If a trigger containing a change of a non-transactional table is added to a transactional table, any changes to the transactional table is "tainted" as non-transactional. This patch solves the problem by removing the existing "hack" that allows non-transactional statements appearing first in a transaction to be written directly to the binary log. Instead, anything inside a transaction is treaded as part of the transaction and not written to the binary log until the transaction is committed. mysql-test/suite/rpl/t/rpl_row_create_table.test: Removing positions from SHOW BINLOG EVENTS and using reset_master_and_slave to start on a fresh binary log each time. mysql-test/suite/rpl/t/rpl_slave_skip.test: Adding explicit commit in AUTOCOMMIT=0 to make test work correctly. mysql-test/suite/rpl/t/rpl_trigger.test: Adding test case for BUG#40116. sql/log.cc: Changing commit logic in binlog_commit() to only commit when committing a real transaction or committing a punch transaction. --- .../binlog/r/binlog_row_mix_innodb_myisam.result | 20 ++--- mysql-test/suite/rpl/r/rpl_row_create_table.result | 95 ++++++++++++++-------- mysql-test/suite/rpl/r/rpl_slave_skip.result | 1 + mysql-test/suite/rpl/r/rpl_trigger.result | 26 ++++++ mysql-test/suite/rpl/t/rpl_row_create_table.test | 28 +++++-- mysql-test/suite/rpl/t/rpl_slave_skip.test | 1 + mysql-test/suite/rpl/t/rpl_trigger.test | 40 +++++++-- sql/log.cc | 61 +------------- 8 files changed, 149 insertions(+), 123 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index 7106480663f..0b33d71b6f1 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -133,10 +133,6 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT insert into t1 values(11); commit; show binlog events from ; @@ -148,8 +144,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ @@ -278,10 +272,6 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; drop table t1,t2 master-bin.000001 # Query # # use `test`; create table t0 (n int) master-bin.000001 # Query # # use `test`; BEGIN @@ -382,7 +372,7 @@ master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2 master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2 master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb master-bin.000001 # Query # # use `test`; BEGIN @@ -395,16 +385,16 @@ master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE t2 master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -412,7 +402,7 @@ master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; ROLLBACK master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 master-bin.000001 # Query # # use `test`; COMMIT diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result index ad659c37b7f..5d6587a5fce 100644 --- a/mysql-test/suite/rpl/r/rpl_row_create_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result @@ -4,34 +4,39 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +**** Resetting master and slave **** +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +START SLAVE; CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; -SHOW BINLOG EVENTS FROM 216; +SHOW BINLOG EVENTS FROM 106; Log_name # -Pos 216 +Pos 106 Event_type Query Server_id # -End_log_pos 309 +End_log_pos 199 Info use `test`; CREATE TABLE t1 (a INT, b INT) Log_name # -Pos 309 +Pos 199 Event_type Query Server_id # -End_log_pos 415 +End_log_pos 305 Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge Log_name # -Pos 415 +Pos 305 Event_type Query Server_id # -End_log_pos 521 +End_log_pos 411 Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8 Log_name # -Pos 521 +Pos 411 Event_type Query Server_id # -End_log_pos 640 +End_log_pos 530 Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8 **** On Master **** SHOW CREATE TABLE t1; @@ -125,9 +130,14 @@ NULL 3 6 NULL 4 2 NULL 5 10 NULL 6 12 +**** Resetting master and slave **** +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +START SLAVE; CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; ERROR 23000: Duplicate entry '2' for key 'b' -SHOW BINLOG EVENTS FROM 1374; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; @@ -137,18 +147,23 @@ a b 1 2 2 4 3 6 -SHOW BINLOG EVENTS FROM 1374; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 1374 Query # 1474 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) -# 1474 Query # 1542 use `test`; BEGIN -# 1542 Table_map # 1584 table_id: # (test.t7) -# 1584 Write_rows # 1640 table_id: # flags: STMT_END_F -# 1640 Query # 1711 use `test`; ROLLBACK +# 106 Query # 206 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) +# 206 Query # 274 use `test`; BEGIN +# 274 Table_map # 316 table_id: # (test.t7) +# 316 Write_rows # 372 table_id: # flags: STMT_END_F +# 372 Query # 443 use `test`; ROLLBACK SELECT * FROM t7 ORDER BY a,b; a b 1 2 2 4 3 6 +**** Resetting master and slave **** +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +START SLAVE; CREATE TEMPORARY TABLE tt4 (a INT, b INT); INSERT INTO tt4 VALUES (4,8), (5,10), (6,12); BEGIN; @@ -156,12 +171,12 @@ INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -SHOW BINLOG EVENTS FROM 1711; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 1711 Query # 1779 use `test`; BEGIN -# 1779 Table_map # 1821 table_id: # (test.t7) -# 1821 Write_rows # 1877 table_id: # flags: STMT_END_F -# 1877 Query # 1946 use `test`; COMMIT +# 106 Query # 174 use `test`; BEGIN +# 174 Table_map # 216 table_id: # (test.t7) +# 216 Write_rows # 272 table_id: # flags: STMT_END_F +# 272 Query # 343 use `test`; ROLLBACK SELECT * FROM t7 ORDER BY a,b; a b 1 2 @@ -178,6 +193,11 @@ a b 4 8 5 10 6 12 +**** Resetting master and slave **** +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +START SLAVE; CREATE TABLE t8 LIKE t4; CREATE TABLE t9 LIKE tt4; CREATE TEMPORARY TABLE tt5 LIKE t4; @@ -196,10 +216,10 @@ Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW BINLOG EVENTS FROM 1946; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 1946 Query # 2032 use `test`; CREATE TABLE t8 LIKE t4 -# 2032 Query # 2171 use `test`; CREATE TABLE `t9` ( +# 106 Query # 192 use `test`; CREATE TABLE t8 LIKE t4 +# 192 Query # 331 use `test`; CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) @@ -276,9 +296,8 @@ a 1 2 3 -SHOW BINLOG EVENTS; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 4 Format_desc # 106 Server ver: #, Binlog ver: # # 106 Query # 192 use `test`; CREATE TABLE t1 (a INT) # 192 Query # 260 use `test`; BEGIN # 260 Table_map # 301 table_id: # (test.t1) @@ -308,7 +327,7 @@ Log_name Pos Event_type Server_id End_log_pos Info # 1329 Query # 1397 use `test`; BEGIN # 1397 Table_map # 1438 table_id: # (test.t1) # 1438 Write_rows # 1482 table_id: # flags: STMT_END_F -# 1482 Query # 1551 use `test`; COMMIT +# 1482 Query # 1553 use `test`; ROLLBACK SHOW TABLES; Tables_in_test t1 @@ -371,9 +390,8 @@ a 4 6 9 -SHOW BINLOG EVENTS; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 4 Format_desc # 106 Server ver: #, Binlog ver: # # 106 Query # 192 use `test`; CREATE TABLE t1 (a INT) # 192 Query # 260 use `test`; BEGIN # 260 Table_map # 301 table_id: # (test.t1) @@ -394,6 +412,11 @@ a 6 9 TRUNCATE TABLE t2; +**** Resetting master and slave **** +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +START SLAVE; BEGIN; INSERT INTO t2 SELECT a*a FROM t1; CREATE TEMPORARY TABLE tt2 @@ -406,14 +429,14 @@ Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back SELECT * FROM t2 ORDER BY a; a -SHOW BINLOG EVENTS FROM 949; +SHOW BINLOG EVENTS FROM 106; Log_name Pos Event_type Server_id End_log_pos Info -# 949 Query # 1017 use `test`; BEGIN -# 1017 Table_map # 1058 table_id: # (test.t2) -# 1058 Write_rows # 1102 table_id: # flags: STMT_END_F -# 1102 Table_map # 1143 table_id: # (test.t2) -# 1143 Write_rows # 1182 table_id: # flags: STMT_END_F -# 1182 Query # 1253 use `test`; ROLLBACK +# 106 Query # 174 use `test`; BEGIN +# 174 Table_map # 215 table_id: # (test.t2) +# 215 Write_rows # 259 table_id: # flags: STMT_END_F +# 259 Table_map # 300 table_id: # (test.t2) +# 300 Write_rows # 339 table_id: # flags: STMT_END_F +# 339 Query # 410 use `test`; ROLLBACK SELECT * FROM t2 ORDER BY a; a DROP TABLE t1,t2; diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result index bb03c3b6cca..9784d6372d2 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_skip.result +++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result @@ -174,6 +174,7 @@ DROP TRIGGER tr2; INSERT INTO t1 VALUES (3,'master/slave'); INSERT INTO t2 VALUES (3,'master/slave'); INSERT INTO t3 VALUES (3,'master/slave'); +COMMIT; SELECT * FROM t1 ORDER BY a; a b 2 master only diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result index 68c82ed037f..5cc75013bf7 100644 --- a/mysql-test/suite/rpl/r/rpl_trigger.result +++ b/mysql-test/suite/rpl/r/rpl_trigger.result @@ -975,3 +975,29 @@ a b 2 b 3 c drop table t1; +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +create table t1 ( f int ) engine = innodb; +create table log ( r int ) engine = myisam; +create trigger tr +after insert on t1 +for each row insert into log values ( new.f ); +set autocommit = 0; +insert into t1 values ( 1 ); +select * from t1; +f +1 +select * from t1; +f +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +select * from t1; +f +select * from t1; +f +drop table t1, log; diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test index 3fb5aa8e1f2..d74eb873270 100644 --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test @@ -29,6 +29,8 @@ SET GLOBAL storage_engine=memory; START SLAVE; --enable_query_log +--source include/reset_master_and_slave.inc + connection master; CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; @@ -36,7 +38,7 @@ CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---query_vertical SHOW BINLOG EVENTS FROM 216 +--query_vertical SHOW BINLOG EVENTS FROM 106 --echo **** On Master **** --query_vertical SHOW CREATE TABLE t1 --query_vertical SHOW CREATE TABLE t2 @@ -65,6 +67,8 @@ SELECT * FROM t5 ORDER BY a,b,c; --query_vertical SHOW CREATE TABLE t6 SELECT * FROM t6 ORDER BY a,b,c; +--source include/reset_master_and_slave.inc + connection master; # Test for erroneous constructions --error ER_DUP_ENTRY @@ -72,7 +76,7 @@ CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; # Shouldn't be written to the binary log --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1374; +SHOW BINLOG EVENTS FROM 106; # Test that INSERT-SELECT works the same way as for SBR. CREATE TABLE t7 (a INT, b INT UNIQUE); @@ -82,10 +86,12 @@ SELECT * FROM t7 ORDER BY a,b; # Should be written to the binary log --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1374; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; +--source include/reset_master_and_slave.inc + connection master; CREATE TEMPORARY TABLE tt4 (a INT, b INT); INSERT INTO tt4 VALUES (4,8), (5,10), (6,12); @@ -94,11 +100,13 @@ INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1711; +SHOW BINLOG EVENTS FROM 106; SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; +--source include/reset_master_and_slave.inc + connection master; CREATE TABLE t8 LIKE t4; CREATE TABLE t9 LIKE tt4; @@ -110,7 +118,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1; --query_vertical SHOW CREATE TABLE t9 --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1946; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; --echo **** On Slave **** --query_vertical SHOW CREATE TABLE t8 @@ -162,7 +170,7 @@ SELECT * FROM t3 ORDER BY a; SELECT * FROM t4 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; SHOW TABLES; SELECT TABLE_NAME,ENGINE @@ -208,13 +216,17 @@ COMMIT; SELECT * FROM t2 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; SELECT * FROM t2 ORDER BY a; connection master; TRUNCATE TABLE t2; +sync_slave_with_master; + +--source include/reset_master_and_slave.inc +connection master; BEGIN; INSERT INTO t2 SELECT a*a FROM t1; CREATE TEMPORARY TABLE tt2 @@ -227,7 +239,7 @@ ROLLBACK; SELECT * FROM t2 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 949; +SHOW BINLOG EVENTS FROM 106; sync_slave_with_master; SELECT * FROM t2 ORDER BY a; diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test index 8a5b1ae0ae4..da25e5631c0 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_skip.test +++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test @@ -121,6 +121,7 @@ DROP TRIGGER tr2; INSERT INTO t1 VALUES (3,'master/slave'); INSERT INTO t2 VALUES (3,'master/slave'); INSERT INTO t3 VALUES (3,'master/slave'); +COMMIT; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test index 911110d17dc..8e911178dcc 100644 --- a/mysql-test/suite/rpl/t/rpl_trigger.test +++ b/mysql-test/suite/rpl/t/rpl_trigger.test @@ -466,21 +466,47 @@ insert into t1 values (2, "b"); drop trigger if exists t1_bi; insert into t1 values (3, "c"); +select * from t1; +sync_slave_with_master; select * from t1; -save_master_pos; -connection slave; -sync_with_master; +connection master; + +drop table t1; +sync_slave_with_master; + +# +# Bug#40116: Uncommited changes are replicated and stay on slave after +# rollback on master +# + +source include/master-slave-reset.inc; +source include/have_innodb.inc; + +connection master; +create table t1 ( f int ) engine = innodb; +create table log ( r int ) engine = myisam; +create trigger tr + after insert on t1 + for each row insert into log values ( new.f ); + +set autocommit = 0; +insert into t1 values ( 1 ); +select * from t1; +sync_slave_with_master; select * from t1; connection master; +rollback; +select * from t1; +sync_slave_with_master; +select * from t1; -drop table t1; +connection master; +drop table t1, log; +sync_slave_with_master; # # End of tests # -save_master_pos; -connection slave; -sync_with_master; diff --git a/sql/log.cc b/sql/log.cc index fb8669a5731..3ebf2a7c03e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1478,60 +1478,11 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) } /* - Decision table for committing a transaction. The top part, the - *conditions* represent different cases that can occur, and hte - bottom part, the *actions*, represent what should be done in that - particular case. + We commit the transaction if: - Real transaction 'all' was true + - We are not in a transaction and committing a statement, or - Statement in cache There were at least one statement in the - transaction cache - - In transaction We are inside a transaction - - Stmt modified non-trans The statement being committed modified a - non-transactional table - - All modified non-trans Some statement before this one in the - transaction modified a non-transactional - table - - - ============================= = = = = = = = = = = = = = = = = - Real transaction N N N N N N N N N N N N N N N N - Statement in cache N N N N N N N N Y Y Y Y Y Y Y Y - In transaction N N N N Y Y Y Y N N N N Y Y Y Y - Stmt modified non-trans N N Y Y N N Y Y N N Y Y N N Y Y - All modified non-trans N Y N Y N Y N Y N Y N Y N Y N Y - - Action: (C)ommit/(A)ccumulate C C - C A C - C - - - - A A - A - ============================= = = = = = = = = = = = = = = = = - - - ============================= = = = = = = = = = = = = = = = = - Real transaction Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y - Statement in cache N N N N N N N N Y Y Y Y Y Y Y Y - In transaction N N N N Y Y Y Y N N N N Y Y Y Y - Stmt modified non-trans N N Y Y N N Y Y N N Y Y N N Y Y - All modified non-trans N Y N Y N Y N Y N Y N Y N Y N Y - - (C)ommit/(A)ccumulate/(-) - - - - C C - C - - - - C C - C - ============================= = = = = = = = = = = = = = = = = - - In other words, we commit the transaction if and only if both of - the following are true: - - We are not in a transaction and committing a statement - - - We are in a transaction and one (or more) of the following are - true: - - - A full transaction is committed - - OR - - - A non-transactional statement is committed and there is - no statement cached + - We are in a transaction and a full transaction is committed Otherwise, we accumulate the statement */ @@ -1544,11 +1495,7 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) YESNO(in_transaction), YESNO(thd->transaction.all.modified_non_trans_table), YESNO(thd->transaction.stmt.modified_non_trans_table))); - if (in_transaction && - (all || - (!trx_data->at_least_one_stmt && - thd->transaction.stmt.modified_non_trans_table)) || - !in_transaction && !all) + if (!in_transaction || all) { Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) -- cgit v1.2.1 From da1bf248526af2ff5037bbe92613c432eeda3b9a Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 4 Dec 2008 01:01:03 +0000 Subject: BUG#38826 Race in MYSQL_LOG::purge_logs is impossible to debug in production BUG#39325 Server crash inside MYSQL_LOG::purge_first_log halts replicaiton The patch reverses the order of the purging and updating events for log and relay-log.info/index files respectively. This solves the problem of having holes caused by crashes happening between updating info/index files and purging logs. NOTE: This is a combined patch for BUG#38826 and BUG#39325. This patch is based on bugteam tree and takes into account reviewers suggestions. --- mysql-test/r/binlog_index.result | 1 + sql/log.cc | 212 ++++++++++++++++++++++++--------------- sql/sql_class.h | 7 ++ 3 files changed, 141 insertions(+), 79 deletions(-) diff --git a/mysql-test/r/binlog_index.result b/mysql-test/r/binlog_index.result index 82fc26092f4..b307b97e460 100644 --- a/mysql-test/r/binlog_index.result +++ b/mysql-test/r/binlog_index.result @@ -21,6 +21,7 @@ flush logs; *** must be a warning master-bin.000001 was not found *** Warnings: Warning 1477 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found +Warning 1477 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found *** must show one record, of the active binlog, left in the index file after PURGE *** show binary logs; Log_name File_size diff --git a/sql/log.cc b/sql/log.cc index 5a1cfe46686..477cb21b2f3 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -417,6 +417,7 @@ MYSQL_LOG::MYSQL_LOG() index_file_name[0] = 0; bzero((char*) &log_file,sizeof(log_file)); bzero((char*) &index_file, sizeof(index_file)); + bzero((char*) &purge_temp, sizeof(purge_temp)); } /* this is called only once */ @@ -1059,10 +1060,10 @@ err: IMPLEMENTATION - Protects index file with LOCK_index + - Read the next file name from the index file and store in rli->linfo - Delete relevant relay log files - Copy all file names after these ones to the front of the index file - If the OS has truncate, truncate the file, else fill it with \n' - - Read the next file name from the index file and store in rli->linfo RETURN VALUES 0 ok @@ -1076,6 +1077,7 @@ err: int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included) { int error; + char *to_purge_if_included= NULL; DBUG_ENTER("purge_first_log"); DBUG_ASSERT(is_open()); @@ -1083,36 +1085,20 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included) DBUG_ASSERT(!strcmp(rli->linfo.log_file_name,rli->event_relay_log_name)); pthread_mutex_lock(&LOCK_index); - pthread_mutex_lock(&rli->log_space_lock); - rli->relay_log.purge_logs(rli->group_relay_log_name, included, - 0, 0, &rli->log_space_total); - // Tell the I/O thread to take the relay_log_space_limit into account - rli->ignore_log_space_limit= 0; - pthread_mutex_unlock(&rli->log_space_lock); + to_purge_if_included= my_strdup(rli->group_relay_log_name, MYF(0)); - /* - Ok to broadcast after the critical region as there is no risk of - the mutex being destroyed by this thread later - this helps save - context switches - */ - pthread_cond_broadcast(&rli->log_space_cond); - /* Read the next log file name from the index file and pass it back to - the caller - If included is true, we want the first relay log; - otherwise we want the one after event_relay_log_name. + the caller. */ - if ((included && (error=find_log_pos(&rli->linfo, NullS, 0))) || - (!included && - ((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) || - (error=find_next_log(&rli->linfo, 0))))) + if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) || + (error=find_next_log(&rli->linfo, 0))) { char buff[22]; sql_print_error("next log error: %d offset: %s log: %s included: %d", error, llstr(rli->linfo.index_file_offset,buff), - rli->group_relay_log_name, + rli->event_relay_log_name, included); goto err; } @@ -1140,7 +1126,42 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included) /* Store where we are in the new file for the execution thread */ flush_relay_log_info(rli); + DBUG_EXECUTE_IF("crash_before_purge_logs", abort();); + + pthread_mutex_lock(&rli->log_space_lock); + rli->relay_log.purge_logs(to_purge_if_included, included, + 0, 0, &rli->log_space_total); + // Tell the I/O thread to take the relay_log_space_limit into account + rli->ignore_log_space_limit= 0; + pthread_mutex_unlock(&rli->log_space_lock); + + /* + Ok to broadcast after the critical region as there is no risk of + the mutex being destroyed by this thread later - this helps save + context switches + */ + pthread_cond_broadcast(&rli->log_space_cond); + + /* + * Need to update the log pos because purge logs has been called + * after fetching initially the log pos at the begining of the method. + */ + if(error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) + { + char buff[22]; + sql_print_error("next log error: %d offset: %s log: %s included: %d", + error, + llstr(rli->linfo.index_file_offset,buff), + rli->group_relay_log_name, + included); + goto err; + } + + /* If included was passed, rli->linfo should be the first entry. */ + DBUG_ASSERT(!included || rli->linfo.index_file_start_offset == 0); + err: + my_free(to_purge_if_included, MYF(0)); pthread_mutex_unlock(&LOCK_index); DBUG_RETURN(error); } @@ -1199,8 +1220,36 @@ int MYSQL_LOG::purge_logs(const char *to_log, if (need_mutex) pthread_mutex_lock(&LOCK_index); - if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/))) + if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/))) + { + sql_print_error("MYSQL_LOG::purge_logs was called with file %s not " + "listed in the index.", to_log); goto err; + } + + /* + For crash recovery reasons the index needs to be updated before + any files are deleted. Move files to be deleted into a temp file + to be processed after the index is updated. + */ + if (!my_b_inited(&purge_temp)) + { + if (error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX, + DISK_BUFFER_SIZE, MYF(MY_WME))) + { + sql_print_error("MYSQL_LOG::purge_logs failed to open purge_temp"); + goto err; + } + } + else + { + if (error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1)) + { + sql_print_error("MYSQL_LOG::purge_logs failed to reinit purge_temp " + "for write"); + goto err; + } + } /* File name exists in index file; delete until we find this file @@ -1211,6 +1260,59 @@ int MYSQL_LOG::purge_logs(const char *to_log, while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) && !log_in_use(log_info.log_file_name)) { + if ((error=my_b_write(&purge_temp, (byte*)log_info.log_file_name, + strlen(log_info.log_file_name))) || + (error=my_b_write(&purge_temp, (byte*)"\n", 1))) + { + sql_print_error("MYSQL_LOG::purge_logs failed to copy %s to purge_temp", + log_info.log_file_name); + goto err; + } + + if (find_next_log(&log_info, 0) || exit_loop) + break; + } + + /* We know how many files to delete. Update index file. */ + if (error=update_log_index(&log_info, need_update_threads)) + { + sql_print_error("MSYQL_LOG::purge_logs failed to update the index file"); + goto err; + } + + DBUG_EXECUTE_IF("crash_after_update_index", abort();); + + /* Switch purge_temp for read. */ + if (error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0)) + { + sql_print_error("MSYQL_LOG::purge_logs failed to reinit purge_temp " + "for read"); + goto err; + } + + /* Read each entry from purge_temp and delete the file. */ + for (;;) + { + uint length; + + if ((length=my_b_gets(&purge_temp, log_info.log_file_name, + FN_REFLEN)) <= 1) + { + if (purge_temp.error) + { + error= purge_temp.error; + sql_print_error("MSYQL_LOG::purge_logs error %d reading from " + "purge_temp", error); + goto err; + } + + /* Reached EOF */ + break; + } + + /* Get rid of the trailing '\n' */ + log_info.log_file_name[length-1]= 0; + MY_STAT s; if (!my_stat(log_info.log_file_name, &s, MYF(0))) { @@ -1304,15 +1406,7 @@ int MYSQL_LOG::purge_logs(const char *to_log, } } } - if (find_next_log(&log_info, 0) || exit_loop) - break; } - - /* - If we get killed -9 here, the sysadmin would have to edit - the log index file after restart - otherwise, this should be safe - */ - error= update_log_index(&log_info, need_update_threads); err: if (need_mutex) @@ -1326,7 +1420,6 @@ err: SYNOPSIS purge_logs_before_date() - thd Thread pointer before_date Delete all log files before given date. NOTES @@ -1343,6 +1436,7 @@ err: int MYSQL_LOG::purge_logs_before_date(time_t purge_time) { int error; + char to_log[FN_REFLEN]; LOG_INFO log_info; MY_STAT stat_area; THD *thd= current_thd; @@ -1350,12 +1444,8 @@ int MYSQL_LOG::purge_logs_before_date(time_t purge_time) DBUG_ENTER("purge_logs_before_date"); pthread_mutex_lock(&LOCK_index); + to_log[0]= 0; - /* - Delete until we find curren file - or a file that is used or a file - that is older than purge_time. - */ if ((error=find_log_pos(&log_info, NullS, 0 /*no mutex*/))) goto err; @@ -1405,54 +1495,18 @@ int MYSQL_LOG::purge_logs_before_date(time_t purge_time) } else { - if (stat_area.st_mtime >= purge_time) + if (stat_area.st_mtime < purge_time) + strmake(to_log, + log_info.log_file_name, + sizeof(log_info.log_file_name)); + else break; - if (my_delete(log_info.log_file_name, MYF(0))) - { - if (my_errno == ENOENT) - { - /* It's not fatal even if we can't delete a log file */ - if (thd) - { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE), - log_info.log_file_name); - } - sql_print_information("Failed to delete file '%s'", - log_info.log_file_name); - my_errno= 0; - } - else - { - if (thd) - { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, - ER_BINLOG_PURGE_FATAL_ERR, - "a problem with deleting %s; " - "consider examining correspondence " - "of your binlog index file " - "to the actual binlog files", - log_info.log_file_name); - } - else - { - sql_print_information("Failed to delete log file '%s'", - log_info.log_file_name); - } - error= LOG_INFO_FATAL; - goto err; - } - } } if (find_next_log(&log_info, 0)) break; } - /* - If we get killed -9 here, the sysadmin would have to edit - the log index file after restart - otherwise, this should be safe - */ - error= update_log_index(&log_info, 1); + error= (to_log[0] ? purge_logs(to_log, 1, 0, 1, (ulonglong *) 0) : 0); err: pthread_mutex_unlock(&LOCK_index); diff --git a/sql/sql_class.h b/sql/sql_class.h index c8d42d44df7..cc7ef7809d4 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -205,6 +205,13 @@ class MYSQL_LOG: public TC_LOG time_t last_time,query_start; IO_CACHE log_file; IO_CACHE index_file; + /* + purge_temp is a temp file used in purge_logs so that the index file + can be updated before deleting files from disk, yielding better crash + recovery. It is created on demand the first time purge_logs is called + and then reused for subsequent calls. It is cleaned up in cleanup(). + */ + IO_CACHE purge_temp; char *name; char time_buff[20],db[NAME_LEN+1]; char log_file_name[FN_REFLEN],index_file_name[FN_REFLEN]; -- cgit v1.2.1 From 06a9022f307a52249853f668f4afe62ab8fb1e8c Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Wed, 3 Dec 2008 21:44:07 -0500 Subject: Bug#40177: Test funcs_1.storedproc failing on Pushbuild Altered param_check to disable warnings on system-sensitive operations and added some notes / possible TODO Re-recorded.result file to account for change --- mysql-test/suite/funcs_1/r/storedproc.result | 1212 -------------------- .../suite/funcs_1/storedproc/param_check.inc | 19 +- 2 files changed, 18 insertions(+), 1213 deletions(-) diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index 38fa933e13f..0c414df0c57 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -191,2427 +191,1215 @@ ERROR 22007: Illegal double '1.7976931348623157493578e+308' value found during p UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+100; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+100, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+100); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+99; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+99, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+99); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+98; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+98, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+98); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+97; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+97, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+97); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+96; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+96, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+96); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+95; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+95, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+95); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+94; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+94, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+94); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+93; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+93, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+93); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+92; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+92, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+92); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+91; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+91, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+91); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+90; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+90, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+90); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+89; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+89, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+89); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+88; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+88, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+88); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+87; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+87, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+87); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+86; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+86, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+86); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+85; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+85, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+85); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+84; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+84, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+84); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+83; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+83, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+83); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+82; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+82, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+82); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+81; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+81, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+81); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+80; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+80, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+80); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+79; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+79, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+79); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+78; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+78, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+78); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+77; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+77, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+77); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+76; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+76, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+76); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+75; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+75, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+75); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+74; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+74, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+74); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+73; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+73, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+73); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+72; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+72, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+72); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+71; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+71, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+71); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+70; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+70, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+70); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+69; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+69, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+69); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+68; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+68, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+68); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+67; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+67, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+67); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+66; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+66, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+66); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+65; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+65, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+65); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+64; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+64, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+64); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+63; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+63, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+63); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+62; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+62, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+62); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+61; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+61, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+61); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+60; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+60, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+60); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+59; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+59, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+59); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+58; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+58, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+58); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+57; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+57, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+57); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+56; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+56, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+56); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+55; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+55, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+55); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+54; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+54, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+54); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+53; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+53, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+53); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+52; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+52, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+52); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+51; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+51, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+51); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+50; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+50, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+50); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+49; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+49, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+49); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+48; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+48, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+48); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+47; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+47, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+47); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+46; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+46, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+46); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+45; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+45, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+45); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+44; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+44, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+44); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+43; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+43, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+43); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+42; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+42, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+42); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+41; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+41, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+41); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+40; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+40, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+40); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+39; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+39, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+39); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+38; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+38, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+38); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+37; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+37, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+37); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+36; -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+36, @v1_proc); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+36); -Warnings: -Warning 1264 Out of range value for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+35; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+35, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+35); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+34; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+34, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+34); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+33; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+33, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+33); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+32; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+32, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+32); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+31; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+31, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+31); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+30; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+30, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+30); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+29; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+29, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+29); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+28; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+28, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+28); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+27; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+27, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+27); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+26; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+26, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+26); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+25; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+25, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+25); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+24; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+24, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+24); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+23; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+23, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+23); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+22; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+22, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+22); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+21; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+21, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+21); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+20; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+20, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+20); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+19; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+19, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+19); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+18; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+18, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+18); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+17; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+17, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+17); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+16; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+16, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+16); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+15; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+15, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+15); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+14; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+14, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+14); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+13; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+13, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+13); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+12; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+12, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+12); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+11; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+11, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+11); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+10; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+10, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+10); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+9; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+9, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+9); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+8; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+8, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+8); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+7; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+7, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+7); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+6; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+6, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+6); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+5; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+5, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+5); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+4; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+4, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+4); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+3; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+3, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+3); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+2; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+2, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+2); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+1; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+1, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+1); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e+0; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e+0, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e+0); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-100; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-100, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-100); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-99; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-99, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-99); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-98; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-98, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-98); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-97; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-97, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-97); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-96; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-96, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-96); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-95; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-95, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-95); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-94; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-94, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-94); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-93; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-93, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-93); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-92; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-92, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-92); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-91; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-91, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-91); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-90; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-90, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-90); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-89; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-89, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-89); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-88; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-88, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-88); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-87; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-87, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-87); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-86; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-86, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-86); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-85; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-85, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-85); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-84; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-84, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-84); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-83; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-83, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-83); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-82; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-82, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-82); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-81; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-81, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-81); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-80; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-80, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-80); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-79; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-79, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-79); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-78; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-78, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-78); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-77; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-77, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-77); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-76; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-76, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-76); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-75; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-75, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-75); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-74; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-74, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-74); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-73; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-73, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-73); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-72; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-72, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-72); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-71; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-71, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-71); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-70; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-70, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-70); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-69; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-69, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-69); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-68; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-68, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-68); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-67; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-67, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-67); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-66; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-66, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-66); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-65; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-65, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-65); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-64; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-64, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-64); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-63; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-63, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-63); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-62; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-62, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-62); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-61; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-61, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-61); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-60; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-60, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-60); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-59; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-59, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-59); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-58; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-58, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-58); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-57; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-57, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-57); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-56; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-56, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-56); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-55; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-55, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-55); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-54; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-54, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-54); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-53; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-53, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-53); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-52; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-52, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-52); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-51; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-51, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-51); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-50; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-50, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-50); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-49; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-49, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-49); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-48; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-48, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-48); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-47; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-47, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-47); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-46; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-46, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-46); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-45; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-45, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-45); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-44; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-44, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-44); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-43; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-43, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-43); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-42; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-42, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-42); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-41; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-41, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-41); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-40; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-40, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-40); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-39; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-39, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-39); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-38; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-38, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-38); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-37; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-37, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-37); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-36; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-36, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-36); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-35; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-35, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-35); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-34; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-34, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-34); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-33; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-33, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-33); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-32; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-32, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-32); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-31; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-31, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-31); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-30; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-30, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-30); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-29; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-29, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-29); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-28; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-28, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-28); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-27; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-27, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-27); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-26; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-26, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-26); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-25; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-25, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-25); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-24; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-24, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-24); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-23; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-23, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-23); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-22; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-22, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-22); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-21; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-21, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-21); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-20; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-20, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-20); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-19; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-19, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-19); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-18; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-18, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-18); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-17; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-17, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-17); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-16; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-16, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-16); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-15; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-15, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-15); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-14; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-14, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-14); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-13; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-13, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-13); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-12; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-12, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-12); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-11; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-11, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-11); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-10; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-10, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-10); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-9; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-9, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-9); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-8; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-8, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-8); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-7; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-7, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-7); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-6; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-6, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-6); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-5; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-5, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-5); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-4; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-4, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-4); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-3; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-3, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-3); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-2; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-2, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-2); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-1; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-1, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-1); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 UPDATE t1_aux SET f1 = NULL; SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; UPDATE t1_aux SET f1 = 0.1234567890987654321e-0; -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SELECT f1 INTO @v1_tab FROM t1_aux; CALL sproc_1(0.1234567890987654321e-0, @v1_proc); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 SET @v1_func = func_1(0.1234567890987654321e-0); -Warnings: -Note 1265 Data truncated for column 'f1' at row 1 DROP PROCEDURE sproc_1; DROP FUNCTION func_1; DROP TABLE t1_aux; diff --git a/mysql-test/suite/funcs_1/storedproc/param_check.inc b/mysql-test/suite/funcs_1/storedproc/param_check.inc index f6c0b30ab8b..203187f92b1 100644 --- a/mysql-test/suite/funcs_1/storedproc/param_check.inc +++ b/mysql-test/suite/funcs_1/storedproc/param_check.inc @@ -16,15 +16,32 @@ # Created: # 2008-08-27 mleich # - +# Modified: +# 2008-11-17 pcrews +# added --disable / --enable_warning statements to minimize differences +# between platforms (Bug#40177 Test funcs_1.storedproc failing on Pushbuild) +# +# TODO: (After 5.1 GA) +# 1) Examine reordering statements in this file to minimize the number of +# --disable / --enable_warning statements. Unsure if performance gains +# warrant the working time +# 2) We could probably add a comparison of the # of warnings before the +# assignment of @v1_proc and @v1_func to the # of warnings after assignment +# The difference of these values should be zero +# Refer to Bug#40177 - http://bugs.mysql.com/bug.php?id=40177 for notes as well + eval UPDATE t1_aux SET f1 = NULL; # Enforce that all user variables have the same data type and initial value. SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; +--disable_warnings eval UPDATE t1_aux SET f1 = $test_value; +--enable_warnings SELECT f1 INTO @v1_tab FROM t1_aux; +--disable_warnings eval CALL sproc_1($test_value, @v1_proc); eval SET @v1_func = func_1($test_value); +--enable_warnings if (`SELECT @v1_tab <> @v1_proc OR @v1_tab <> @v2_proc OR @v1_tab <> @v1_func`) { -- cgit v1.2.1 From 8adc9d1b86317fceb57611565dc344e5baa05eb0 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Thu, 4 Dec 2008 10:47:25 +0100 Subject: Bug#40515: Query on a partitioned table does not return 'lock wait timeout exceeded' Problem was a bug in the implementation of scan in partitioning which masked the error code from the partition's handler. Fixed by returning the value from the underlying handler. mysql-test/suite/parts/r/partition_special_innodb.result: Bug#40515: Query on a partitioned table does not return 'lock wait timeout exceeded' Updated test result mysql-test/suite/parts/t/partition_special_innodb.test: Bug#40515: Query on a partitioned table does not return 'lock wait timeout exceeded' Updated test case for covering the bug. sql/ha_partition.cc: Bug#40515: Query on a partitioned table does not return 'lock wait timeout exceeded' Removing redeclaration of result variable, which resulted in never returning the correct return value. --- mysql-test/suite/parts/r/partition_special_innodb.result | 5 +++++ mysql-test/suite/parts/t/partition_special_innodb.test | 2 ++ sql/ha_partition.cc | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result index 5eab78de8c2..8869f6d450c 100644 --- a/mysql-test/suite/parts/r/partition_special_innodb.result +++ b/mysql-test/suite/parts/r/partition_special_innodb.result @@ -213,5 +213,10 @@ START TRANSACTION; INSERT INTO t1 VALUES (NULL, 'first row t2'); SET autocommit=OFF; ALTER TABLE t1 AUTO_INCREMENT = 10; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction INSERT INTO t1 VALUES (NULL, 'second row t2'); +SELECT a,b FROM t1 ORDER BY a; +a b +1 first row t2 +2 second row t2 DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/partition_special_innodb.test b/mysql-test/suite/parts/t/partition_special_innodb.test index b9fc8bdcd56..eac19f6d588 100644 --- a/mysql-test/suite/parts/t/partition_special_innodb.test +++ b/mysql-test/suite/parts/t/partition_special_innodb.test @@ -68,10 +68,12 @@ INSERT INTO t1 VALUES (NULL, 'first row t2'); --connection con2 SET autocommit=OFF; +--error ER_LOCK_WAIT_TIMEOUT ALTER TABLE t1 AUTO_INCREMENT = 10; --connection con1 INSERT INTO t1 VALUES (NULL, 'second row t2'); +SELECT a,b FROM t1 ORDER BY a; --disconnect con2 --disconnect con1 --connection default diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 0c96b06381c..852f437b213 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3431,7 +3431,7 @@ int ha_partition::rnd_next(uchar *buf) while (TRUE) { - int result= file->rnd_next(buf); + result= file->rnd_next(buf); if (!result) { m_last_part= part_id; -- cgit v1.2.1 From 6d717c21e7588e38812537ce11e636d3e4a5cd6b Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Thu, 4 Dec 2008 18:36:45 +0200 Subject: Bug #33420 Test 'rpl_packet' fails randomly with changed "Exec_Master_Log_Pos" Bug #41173 rpl_packet fails sporadically on pushbuild: query 'DROP TABLE t1' failed The both issues appeared to be a race between the SQL thread executing CREATE table t1 and the IO thread that is expected to stop at the consequent big size event. The two events need serialization which is implemented. The early bug required back-porting a part fixes for bug#38350 exclusively for 5.0 version. mysql-test/r/rpl_packet.result: results changed due to bug#33420, bug#41173. mysql-test/t/rpl_packet.test: adding synchronization for sql and io thread (bug#41173 problem). simplifying the output to show only a relevant info (5.0 sole problem bug#33420). --- mysql-test/r/rpl_packet.result | 40 +++++----------------------------------- mysql-test/t/rpl_packet.test | 22 ++++++++++++++++------ 2 files changed, 21 insertions(+), 41 deletions(-) diff --git a/mysql-test/r/rpl_packet.result b/mysql-test/r/rpl_packet.result index 88c63994fff..f84ce18810e 100644 --- a/mysql-test/r/rpl_packet.result +++ b/mysql-test/r/rpl_packet.result @@ -23,39 +23,9 @@ SET @@global.max_allowed_packet=4096; SET @@global.net_buffer_length=4096; STOP SLAVE; START SLAVE; -CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM; +CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); -show slave status; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port MASTER_MYPORT -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos 2138 -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running No -Slave_SQL_Running # -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 0 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos 2138 -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # +Slave_IO_Running = No (expect No) +==== clean up ==== +DROP TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/t/rpl_packet.test b/mysql-test/t/rpl_packet.test index a3efdf24bce..f7066c93b30 100644 --- a/mysql-test/t/rpl_packet.test +++ b/mysql-test/t/rpl_packet.test @@ -73,16 +73,26 @@ disconnect master; connect (master, localhost, root); connection master; -CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM; +CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM; + +sync_slave_with_master; + +connection master; INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048'); # The slave I/O thread must stop after trying to read the above event connection slave; ---source include/wait_for_slave_io_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_MYPORT -# import is only the 11th column Slave_IO_Running ---replace_column 1 # 8 # 9 # 12 # 23 # 33 # -query_vertical show slave status; +--source include/wait_for_slave_io_to_stop.inc +let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); +--echo Slave_IO_Running = $slave_io_running (expect No) + + +--echo ==== clean up ==== +connection master; +DROP TABLE t1; +# slave is stopped +connection slave; +DROP TABLE t1; # End of tests -- cgit v1.2.1 From 832770842e85048bb56b99a1dd448dbda59593a8 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Fri, 5 Dec 2008 10:23:27 +0100 Subject: Bug #40116: Uncommited changes are replicated and stay on slave after rollback on master Making test slightly more generic and robust. mysql-test/suite/rpl/t/rpl_trigger.test: Adding code to check that InnoDB is available on slave as well. Making code slightly more generic. --- mysql-test/suite/rpl/r/rpl_trigger.result | 11 ++--------- mysql-test/suite/rpl/t/rpl_trigger.test | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result index 5cc75013bf7..b68af8f4afe 100644 --- a/mysql-test/suite/rpl/r/rpl_trigger.result +++ b/mysql-test/suite/rpl/r/rpl_trigger.result @@ -988,16 +988,9 @@ after insert on t1 for each row insert into log values ( new.f ); set autocommit = 0; insert into t1 values ( 1 ); -select * from t1; -f -1 -select * from t1; -f rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -select * from t1; -f -select * from t1; -f +Comparing tables master:test.t1 and slave:test.t1 +Comparing tables master:test.log and slave:test.log drop table t1, log; diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test index 8e911178dcc..d63eafe56a7 100644 --- a/mysql-test/suite/rpl/t/rpl_trigger.test +++ b/mysql-test/suite/rpl/t/rpl_trigger.test @@ -480,8 +480,11 @@ sync_slave_with_master; # rollback on master # +connection master; source include/master-slave-reset.inc; source include/have_innodb.inc; +connection slave; +source include/have_innodb.inc; connection master; create table t1 ( f int ) engine = innodb; @@ -492,16 +495,15 @@ create trigger tr set autocommit = 0; insert into t1 values ( 1 ); +rollback; -select * from t1; -sync_slave_with_master; -select * from t1; +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +--source include/diff_tables.inc -connection master; -rollback; -select * from t1; -sync_slave_with_master; -select * from t1; +let $diff_table_1=master:test.log; +let $diff_table_2=slave:test.log; +--source include/diff_tables.inc connection master; drop table t1, log; -- cgit v1.2.1 From 789bbbb037756bba47c6306228bf9b7d80cafb24 Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Fri, 5 Dec 2008 08:21:03 -0500 Subject: Bug#41258: mysql-test-run does not copy subdirectories of std_data on Windows (5.0 only) Altered how we copy data from mysql-test/std_data on Windows to match what we are doing in 5.1 and 6.0 --- mysql-test/mysql-test-run.pl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 268dd3fbd16..70637034b6e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2380,13 +2380,7 @@ sub setup_vardir() { { # on windows, copy all files from std_data into var/std_data_ln mkpath("$opt_vardir/std_data_ln"); - opendir(DIR, "$glob_mysql_test_dir/std_data") - or mtr_error("Can't find the std_data directory: $!"); - for(readdir(DIR)) { - next if -d "$glob_mysql_test_dir/std_data/$_"; - copy("$glob_mysql_test_dir/std_data/$_", "$opt_vardir/std_data_ln/$_"); - } - closedir(DIR); + mtr_copy_dir("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln"); } # Remove old log files -- cgit v1.2.1 From 758613481405f5c1281773e300e8f7c75201ce9c Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Fri, 5 Dec 2008 16:43:13 +0100 Subject: Fix for Bug#36878 after review by Matthias: Only one line in the result files of 32 bit and 64 bit platforms differed and made problems on 64 bit machine with 32 bit mysqld. The removal of the separation into 32 bit and 64 bit versions of that test fixes also this problem. --- .../suite/sys_vars/inc/tmp_table_size_basic.inc | 209 --------------------- .../suite/sys_vars/r/tmp_table_size_basic.result | 146 ++++++++++++++ .../sys_vars/r/tmp_table_size_basic_32.result | 166 ---------------- .../sys_vars/r/tmp_table_size_basic_64.result | 166 ---------------- .../suite/sys_vars/t/tmp_table_size_basic.test | 206 ++++++++++++++++++++ .../suite/sys_vars/t/tmp_table_size_basic_32.test | 9 - .../suite/sys_vars/t/tmp_table_size_basic_64.test | 9 - 7 files changed, 352 insertions(+), 559 deletions(-) delete mode 100644 mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc create mode 100644 mysql-test/suite/sys_vars/r/tmp_table_size_basic.result delete mode 100644 mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result delete mode 100644 mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result create mode 100644 mysql-test/suite/sys_vars/t/tmp_table_size_basic.test delete mode 100644 mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test delete mode 100644 mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test diff --git a/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc b/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc deleted file mode 100644 index d29ef6da094..00000000000 --- a/mysql-test/suite/sys_vars/inc/tmp_table_size_basic.inc +++ /dev/null @@ -1,209 +0,0 @@ -############## mysql-test\t\tmp_table_size_basic.test ######################### -# # -# Variable Name: tmp_table_size # -# Scope: GLOBAL | SESSION # -# Access Type: Dynamic # -# Data Type: numeric # -# Default Value: 33554432 # -# Range: 1024-4294967295 # -# # -# # -# Creation Date: 2008-02-13 # -# Author: Salman # -# # -# Description: Test Cases of Dynamic System Variable tmp_table_size # -# that checks the behavior of this variable in the following ways# -# * Default Value # -# * Valid & Invalid values # -# * Scope & Access method # -# * Data Integrity # -# # -# Reference: # -# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # -# # -############################################################################### - ---source include/load_sysvars.inc - -############################################################## -# START OF tmp_table_size TESTS # -############################################################## - -############################################################# -# Save initial value # -############################################################# - -SET @start_global_value = @@global.tmp_table_size; -SELECT @start_global_value; -SET @start_session_value = @@session.tmp_table_size; -SELECT @start_session_value; - ---echo '#--------------------FN_DYNVARS_005_01-------------------------#' -############################################################## -# Display the DEFAULT value of tmp_table_size # -############################################################## - -SET @@global.tmp_table_size = 100; -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size; - -SET @@session.tmp_table_size = 200; -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size; - ---echo '#--------------------FN_DYNVARS_005_02-------------------------#' -######################################################################## -# Check the DEFAULT value of tmp_table_size # -######################################################################## - -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size = 33554432; - -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size = 33554432; - ---echo '#--------------------FN_DYNVARS_005_03-------------------------#' -######################################################################## -# Change the value of tmp_table_size to a valid value for GLOBAL Scope # -######################################################################## - -SET @@global.tmp_table_size = 1024; -SELECT @@global.tmp_table_size; -SET @@global.tmp_table_size = 60020; -SELECT @@global.tmp_table_size; -SET @@global.tmp_table_size = 4294967295; -SELECT @@global.tmp_table_size; - - ---echo '#--------------------FN_DYNVARS_005_04-------------------------#' -######################################################################### -# Change the value of tmp_table_size to a valid value for SESSION Scope # -######################################################################### - -SET @@session.tmp_table_size = 1024; -SELECT @@session.tmp_table_size; - -SET @@session.tmp_table_size =4294967295; -SELECT @@session.tmp_table_size; -SET @@session.tmp_table_size = 65535; -SELECT @@session.tmp_table_size; - - ---echo '#------------------FN_DYNVARS_005_05-----------------------#' -########################################################## -# Change the value of tmp_table_size to an invalid value # -########################################################## - -SET @@global.tmp_table_size = 0; -SELECT @@global.tmp_table_size; - -SET @@global.tmp_table_size = -1024; -SELECT @@global.tmp_table_size; - -SET @@global.tmp_table_size = 1000; -SELECT @@global.tmp_table_size; - --- Error ER_WRONG_TYPE_FOR_VAR -SET @@global.tmp_table_size = ON; - --- Error ER_WRONG_TYPE_FOR_VAR -SET @@global.tmp_table_size = OFF; - -SET @@global.tmp_table_size = True; -SELECT @@global.tmp_table_size; - -SET @@global.tmp_table_size = False; -SELECT @@global.tmp_table_size; - --- Error ER_WRONG_TYPE_FOR_VAR -SET @@global.tmp_table_size = 65530.34; - --- Error ER_WRONG_TYPE_FOR_VAR -SET @@global.tmp_table_size ="Test"; - --- Error ER_WRONG_TYPE_FOR_VAR -SET @@session.tmp_table_size = ON; - --- Error ER_WRONG_TYPE_FOR_VAR -SET @@session.tmp_table_size = OFF; - -SET @@session.tmp_table_size = True; -SELECT @@session.tmp_table_size; - -SET @@session.tmp_table_size = False; -SELECT @@session.tmp_table_size; - --- Error ER_WRONG_TYPE_FOR_VAR -SET @@session.tmp_table_size = "Test"; - -SET @@session.tmp_table_size = 12345678901; -SELECT @@session.tmp_table_size; - ---echo '#------------------FN_DYNVARS_005_06-----------------------#' -#################################################################### -# Check if the value in GLOBAL Table matches value in variable # -#################################################################### - -SELECT @@global.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='tmp_table_size'; - ---echo '#------------------FN_DYNVARS_005_07-----------------------#' -#################################################################### -# Check if the value in SESSION Table matches value in variable # -#################################################################### - -SELECT @@session.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='tmp_table_size'; - ---echo '#---------------------FN_DYNVARS_001_09----------------------#' -######################################################################## -# Check if global and session variables are independent of each other # -######################################################################## - -SET @@global.tmp_table_size = 1024; -SET @@tmp_table_size = 4294967295; -SELECT @@tmp_table_size = @@global.tmp_table_size; - ---echo '#---------------------FN_DYNVARS_001_10----------------------#' -################################################################## -# Check if accessing variable with SESSION,LOCAL and without # -# SCOPE points to same session variable # -################################################################## - -SET @@tmp_table_size = 100; -SELECT @@tmp_table_size = @@local.tmp_table_size; -SELECT @@local.tmp_table_size = @@session.tmp_table_size; - - ---echo '#---------------------FN_DYNVARS_001_11----------------------#' -######################################################################### -# Check if tmp_table_size can be accessed with and without @@ sign # -######################################################################### - -SET tmp_table_size = 1027; -SELECT @@tmp_table_size; - ---Error ER_UNKNOWN_TABLE -SELECT local.tmp_table_size; - ---Error ER_UNKNOWN_TABLE -SELECT global.tmp_table_size; - ---Error ER_BAD_FIELD_ERROR -SELECT tmp_table_size = @@session.tmp_table_size; - -#################################### -# Restore initial value # -#################################### - -SET @@global.tmp_table_size = @start_global_value; -SELECT @@global.tmp_table_size; -SET @@session.tmp_table_size = @start_session_value; -SELECT @@session.tmp_table_size; - -################################################### -# END OF tmp_table_size TESTS # -################################################### - diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result new file mode 100644 index 00000000000..3b4099d30ae --- /dev/null +++ b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result @@ -0,0 +1,146 @@ +SET @start_global_value = @@global.tmp_table_size; +SET @start_session_value = @@session.tmp_table_size; +'#--------------------FN_DYNVARS_005_01-------------------------#' +SET @@global.tmp_table_size = 100; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '100' +SET @@global.tmp_table_size = DEFAULT; +SET @@session.tmp_table_size = 200; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '200' +SET @@session.tmp_table_size = DEFAULT; +'#--------------------FN_DYNVARS_005_02-------------------------#' +SELECT @@global.tmp_table_size >= 16777216; +@@global.tmp_table_size >= 16777216 +1 +SELECT @@session.tmp_table_size >= 16777216; +@@session.tmp_table_size >= 16777216 +1 +'#--------------------FN_DYNVARS_005_03-------------------------#' +SET @@global.tmp_table_size = 1024; +SELECT @@global.tmp_table_size; +@@global.tmp_table_size +1024 +SET @@global.tmp_table_size = 60020; +SELECT @@global.tmp_table_size; +@@global.tmp_table_size +60020 +SET @@global.tmp_table_size = 4294967295; +SELECT @@global.tmp_table_size; +@@global.tmp_table_size +4294967295 +'#--------------------FN_DYNVARS_005_04-------------------------#' +SET @@session.tmp_table_size = 1024; +SELECT @@session.tmp_table_size; +@@session.tmp_table_size +1024 +SET @@session.tmp_table_size = 4294967295; +SELECT @@session.tmp_table_size; +@@session.tmp_table_size +4294967295 +SET @@session.tmp_table_size = 65535; +SELECT @@session.tmp_table_size; +@@session.tmp_table_size +65535 +'#------------------FN_DYNVARS_005_05-----------------------#' +SET @@global.tmp_table_size = 0; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '0' +SELECT @@global.tmp_table_size; +@@global.tmp_table_size +1024 +SET @@global.tmp_table_size = -1024; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '0' +SELECT @@global.tmp_table_size; +@@global.tmp_table_size +1024 +SET @@global.tmp_table_size = 1000; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1000' +SELECT @@global.tmp_table_size; +@@global.tmp_table_size +1024 +SET @@global.tmp_table_size = ON; +ERROR 42000: Incorrect argument type to variable 'tmp_table_size' +SET @@global.tmp_table_size = OFF; +ERROR 42000: Incorrect argument type to variable 'tmp_table_size' +SET @@global.tmp_table_size = True; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1' +SELECT @@global.tmp_table_size; +@@global.tmp_table_size +1024 +SET @@global.tmp_table_size = False; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '0' +SELECT @@global.tmp_table_size; +@@global.tmp_table_size +1024 +SET @@global.tmp_table_size = 65530.34; +ERROR 42000: Incorrect argument type to variable 'tmp_table_size' +SET @@global.tmp_table_size ="Test"; +ERROR 42000: Incorrect argument type to variable 'tmp_table_size' +SET @@session.tmp_table_size = ON; +ERROR 42000: Incorrect argument type to variable 'tmp_table_size' +SET @@session.tmp_table_size = OFF; +ERROR 42000: Incorrect argument type to variable 'tmp_table_size' +SET @@session.tmp_table_size = True; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1' +SELECT @@session.tmp_table_size; +@@session.tmp_table_size +1024 +SET @@session.tmp_table_size = False; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '0' +SELECT @@session.tmp_table_size; +@@session.tmp_table_size +1024 +SET @@session.tmp_table_size = "Test"; +ERROR 42000: Incorrect argument type to variable 'tmp_table_size' +SET @@session.tmp_table_size = 12345678901; +SELECT @@session.tmp_table_size IN (12345678901,4294967295); +@@session.tmp_table_size IN (12345678901,4294967295) +1 +'#------------------FN_DYNVARS_005_06-----------------------#' +SELECT @@global.tmp_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tmp_table_size'; +@@global.tmp_table_size = VARIABLE_VALUE +1 +'#------------------FN_DYNVARS_005_07-----------------------#' +SELECT @@session.tmp_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='tmp_table_size'; +@@session.tmp_table_size = VARIABLE_VALUE +1 +'#---------------------FN_DYNVARS_001_09----------------------#' +SET @@global.tmp_table_size = 1024; +SET @@tmp_table_size = 4294967295; +SELECT @@tmp_table_size = @@global.tmp_table_size; +@@tmp_table_size = @@global.tmp_table_size +0 +'#---------------------FN_DYNVARS_001_10----------------------#' +SET @@tmp_table_size = 100; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '100' +SELECT @@tmp_table_size = @@local.tmp_table_size; +@@tmp_table_size = @@local.tmp_table_size +1 +SELECT @@local.tmp_table_size = @@session.tmp_table_size; +@@local.tmp_table_size = @@session.tmp_table_size +1 +'#---------------------FN_DYNVARS_001_11----------------------#' +SET tmp_table_size = 1027; +SELECT @@tmp_table_size; +@@tmp_table_size +1027 +SELECT local.tmp_table_size; +ERROR 42S02: Unknown table 'local' in field list +SELECT global.tmp_table_size; +ERROR 42S02: Unknown table 'global' in field list +SELECT tmp_table_size = @@session.tmp_table_size; +ERROR 42S22: Unknown column 'tmp_table_size' in 'field list' +SET @@global.tmp_table_size = @start_global_value; +SET @@session.tmp_table_size = @start_session_value; diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result deleted file mode 100644 index ba3fd5420c6..00000000000 --- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_32.result +++ /dev/null @@ -1,166 +0,0 @@ -SET @start_global_value = @@global.tmp_table_size; -SELECT @start_global_value; -@start_global_value -16777216 -SET @start_session_value = @@session.tmp_table_size; -SELECT @start_session_value; -@start_session_value -16777216 -'#--------------------FN_DYNVARS_005_01-------------------------#' -SET @@global.tmp_table_size = 100; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '100' -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -16777216 -SET @@session.tmp_table_size = 200; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '200' -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -16777216 -'#--------------------FN_DYNVARS_005_02-------------------------#' -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size = 33554432; -@@global.tmp_table_size = 33554432 -0 -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size = 33554432; -@@session.tmp_table_size = 33554432 -0 -'#--------------------FN_DYNVARS_005_03-------------------------#' -SET @@global.tmp_table_size = 1024; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = 60020; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -60020 -SET @@global.tmp_table_size = 4294967295; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -4294967295 -'#--------------------FN_DYNVARS_005_04-------------------------#' -SET @@session.tmp_table_size = 1024; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size =4294967295; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -4294967295 -SET @@session.tmp_table_size = 65535; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -65535 -'#------------------FN_DYNVARS_005_05-----------------------#' -SET @@global.tmp_table_size = 0; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = -1024; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = 1000; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1000' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = ON; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size = OFF; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size = True; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = False; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = 65530.34; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size ="Test"; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = ON; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = OFF; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = True; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1' -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size = False; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size = "Test"; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = 12345678901; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -4294967295 -'#------------------FN_DYNVARS_005_06-----------------------#' -SELECT @@global.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='tmp_table_size'; -@@global.tmp_table_size = VARIABLE_VALUE -1 -'#------------------FN_DYNVARS_005_07-----------------------#' -SELECT @@session.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='tmp_table_size'; -@@session.tmp_table_size = VARIABLE_VALUE -1 -'#---------------------FN_DYNVARS_001_09----------------------#' -SET @@global.tmp_table_size = 1024; -SET @@tmp_table_size = 4294967295; -SELECT @@tmp_table_size = @@global.tmp_table_size; -@@tmp_table_size = @@global.tmp_table_size -0 -'#---------------------FN_DYNVARS_001_10----------------------#' -SET @@tmp_table_size = 100; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '100' -SELECT @@tmp_table_size = @@local.tmp_table_size; -@@tmp_table_size = @@local.tmp_table_size -1 -SELECT @@local.tmp_table_size = @@session.tmp_table_size; -@@local.tmp_table_size = @@session.tmp_table_size -1 -'#---------------------FN_DYNVARS_001_11----------------------#' -SET tmp_table_size = 1027; -SELECT @@tmp_table_size; -@@tmp_table_size -1027 -SELECT local.tmp_table_size; -ERROR 42S02: Unknown table 'local' in field list -SELECT global.tmp_table_size; -ERROR 42S02: Unknown table 'global' in field list -SELECT tmp_table_size = @@session.tmp_table_size; -ERROR 42S22: Unknown column 'tmp_table_size' in 'field list' -SET @@global.tmp_table_size = @start_global_value; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -16777216 -SET @@session.tmp_table_size = @start_session_value; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -16777216 diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result deleted file mode 100644 index 73ebaecf5f0..00000000000 --- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic_64.result +++ /dev/null @@ -1,166 +0,0 @@ -SET @start_global_value = @@global.tmp_table_size; -SELECT @start_global_value; -@start_global_value -16777216 -SET @start_session_value = @@session.tmp_table_size; -SELECT @start_session_value; -@start_session_value -16777216 -'#--------------------FN_DYNVARS_005_01-------------------------#' -SET @@global.tmp_table_size = 100; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '100' -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -16777216 -SET @@session.tmp_table_size = 200; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '200' -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -16777216 -'#--------------------FN_DYNVARS_005_02-------------------------#' -SET @@global.tmp_table_size = DEFAULT; -SELECT @@global.tmp_table_size = 33554432; -@@global.tmp_table_size = 33554432 -0 -SET @@session.tmp_table_size = DEFAULT; -SELECT @@session.tmp_table_size = 33554432; -@@session.tmp_table_size = 33554432 -0 -'#--------------------FN_DYNVARS_005_03-------------------------#' -SET @@global.tmp_table_size = 1024; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = 60020; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -60020 -SET @@global.tmp_table_size = 4294967295; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -4294967295 -'#--------------------FN_DYNVARS_005_04-------------------------#' -SET @@session.tmp_table_size = 1024; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size =4294967295; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -4294967295 -SET @@session.tmp_table_size = 65535; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -65535 -'#------------------FN_DYNVARS_005_05-----------------------#' -SET @@global.tmp_table_size = 0; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = -1024; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = 1000; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1000' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = ON; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size = OFF; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size = True; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = False; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -1024 -SET @@global.tmp_table_size = 65530.34; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@global.tmp_table_size ="Test"; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = ON; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = OFF; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = True; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '1' -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size = False; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -1024 -SET @@session.tmp_table_size = "Test"; -ERROR 42000: Incorrect argument type to variable 'tmp_table_size' -SET @@session.tmp_table_size = 12345678901; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -12345678901 -'#------------------FN_DYNVARS_005_06-----------------------#' -SELECT @@global.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES -WHERE VARIABLE_NAME='tmp_table_size'; -@@global.tmp_table_size = VARIABLE_VALUE -1 -'#------------------FN_DYNVARS_005_07-----------------------#' -SELECT @@session.tmp_table_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES -WHERE VARIABLE_NAME='tmp_table_size'; -@@session.tmp_table_size = VARIABLE_VALUE -1 -'#---------------------FN_DYNVARS_001_09----------------------#' -SET @@global.tmp_table_size = 1024; -SET @@tmp_table_size = 4294967295; -SELECT @@tmp_table_size = @@global.tmp_table_size; -@@tmp_table_size = @@global.tmp_table_size -0 -'#---------------------FN_DYNVARS_001_10----------------------#' -SET @@tmp_table_size = 100; -Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '100' -SELECT @@tmp_table_size = @@local.tmp_table_size; -@@tmp_table_size = @@local.tmp_table_size -1 -SELECT @@local.tmp_table_size = @@session.tmp_table_size; -@@local.tmp_table_size = @@session.tmp_table_size -1 -'#---------------------FN_DYNVARS_001_11----------------------#' -SET tmp_table_size = 1027; -SELECT @@tmp_table_size; -@@tmp_table_size -1027 -SELECT local.tmp_table_size; -ERROR 42S02: Unknown table 'local' in field list -SELECT global.tmp_table_size; -ERROR 42S02: Unknown table 'global' in field list -SELECT tmp_table_size = @@session.tmp_table_size; -ERROR 42S22: Unknown column 'tmp_table_size' in 'field list' -SET @@global.tmp_table_size = @start_global_value; -SELECT @@global.tmp_table_size; -@@global.tmp_table_size -16777216 -SET @@session.tmp_table_size = @start_session_value; -SELECT @@session.tmp_table_size; -@@session.tmp_table_size -16777216 diff --git a/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test new file mode 100644 index 00000000000..c2ff51d50ca --- /dev/null +++ b/mysql-test/suite/sys_vars/t/tmp_table_size_basic.test @@ -0,0 +1,206 @@ +########################### tmp_table_size_basic.test ########################## +# # +# Variable Name: tmp_table_size # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: system dependend # +# Range: 1024-system dependend # +# # +# # +# Creation Date: 2008-02-13 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable tmp_table_size # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# Modified: 2008-12-04 HHunger # +# removed the differences between 64 and 32 bit platforms # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################ + +--source include/load_sysvars.inc + +############################################################## +# START OF tmp_table_size TESTS # +############################################################## + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.tmp_table_size; +SET @start_session_value = @@session.tmp_table_size; + +--echo '#--------------------FN_DYNVARS_005_01-------------------------#' +############################################################## +# Display the DEFAULT value of tmp_table_size # +############################################################## + +SET @@global.tmp_table_size = 100; +SET @@global.tmp_table_size = DEFAULT; + +SET @@session.tmp_table_size = 200; +SET @@session.tmp_table_size = DEFAULT; + +--echo '#--------------------FN_DYNVARS_005_02-------------------------#' +######################################################################## +# Check the DEFAULT value of tmp_table_size # +######################################################################## +# The DEFAULT value is system dependend. +# Therefore we have only a plausibility check here +SELECT @@global.tmp_table_size >= 16777216; + +SELECT @@session.tmp_table_size >= 16777216; + +--echo '#--------------------FN_DYNVARS_005_03-------------------------#' +######################################################################## +# Change the value of tmp_table_size to a valid value for GLOBAL Scope # +######################################################################## + +SET @@global.tmp_table_size = 1024; +SELECT @@global.tmp_table_size; +SET @@global.tmp_table_size = 60020; +SELECT @@global.tmp_table_size; +SET @@global.tmp_table_size = 4294967295; +SELECT @@global.tmp_table_size; + + +--echo '#--------------------FN_DYNVARS_005_04-------------------------#' +######################################################################### +# Change the value of tmp_table_size to a valid value for SESSION Scope # +######################################################################### + +SET @@session.tmp_table_size = 1024; +SELECT @@session.tmp_table_size; + +SET @@session.tmp_table_size = 4294967295; +SELECT @@session.tmp_table_size; +SET @@session.tmp_table_size = 65535; +SELECT @@session.tmp_table_size; + + +--echo '#------------------FN_DYNVARS_005_05-----------------------#' +########################################################## +# Change the value of tmp_table_size to an invalid value # +########################################################## + +SET @@global.tmp_table_size = 0; +SELECT @@global.tmp_table_size; + +SET @@global.tmp_table_size = -1024; +SELECT @@global.tmp_table_size; + +SET @@global.tmp_table_size = 1000; +SELECT @@global.tmp_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_table_size = ON; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_table_size = OFF; + +SET @@global.tmp_table_size = True; +SELECT @@global.tmp_table_size; + +SET @@global.tmp_table_size = False; +SELECT @@global.tmp_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_table_size = 65530.34; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.tmp_table_size ="Test"; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_table_size = ON; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_table_size = OFF; + +SET @@session.tmp_table_size = True; +SELECT @@session.tmp_table_size; + +SET @@session.tmp_table_size = False; +SELECT @@session.tmp_table_size; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.tmp_table_size = "Test"; + +SET @@session.tmp_table_size = 12345678901; + +# With a 64 bit mysqld:12345678901,with a 32 bit mysqld: 4294967295 +SELECT @@session.tmp_table_size IN (12345678901,4294967295); + +--echo '#------------------FN_DYNVARS_005_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SELECT @@global.tmp_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tmp_table_size'; + +--echo '#------------------FN_DYNVARS_005_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.tmp_table_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='tmp_table_size'; + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +######################################################################## +# Check if global and session variables are independent of each other # +######################################################################## + +SET @@global.tmp_table_size = 1024; +SET @@tmp_table_size = 4294967295; +SELECT @@tmp_table_size = @@global.tmp_table_size; + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +################################################################## +# Check if accessing variable with SESSION,LOCAL and without # +# SCOPE points to same session variable # +################################################################## + +SET @@tmp_table_size = 100; +SELECT @@tmp_table_size = @@local.tmp_table_size; +SELECT @@local.tmp_table_size = @@session.tmp_table_size; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +######################################################################### +# Check if tmp_table_size can be accessed with and without @@ sign # +######################################################################### + +SET tmp_table_size = 1027; +SELECT @@tmp_table_size; + +--Error ER_UNKNOWN_TABLE +SELECT local.tmp_table_size; + +--Error ER_UNKNOWN_TABLE +SELECT global.tmp_table_size; + +--Error ER_BAD_FIELD_ERROR +SELECT tmp_table_size = @@session.tmp_table_size; + +#################################### +# Restore initial value # +#################################### + +SET @@global.tmp_table_size = @start_global_value; +SET @@session.tmp_table_size = @start_session_value; + +################################################### +# END OF tmp_table_size TESTS # +################################################### + diff --git a/mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test deleted file mode 100644 index c772b5c896c..00000000000 --- a/mysql-test/suite/sys_vars/t/tmp_table_size_basic_32.test +++ /dev/null @@ -1,9 +0,0 @@ -################################################################################ -# Created by Horst Hunger 2008-05-07 # -# # -# Wrapper for 32 bit machines # -################################################################################ - ---source include/have_32bit.inc ---source suite/sys_vars/inc/tmp_table_size_basic.inc - diff --git a/mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test b/mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test deleted file mode 100644 index 46b3f65be9a..00000000000 --- a/mysql-test/suite/sys_vars/t/tmp_table_size_basic_64.test +++ /dev/null @@ -1,9 +0,0 @@ -################################################################################ -# Created by Horst Hunger 2008-05-07 # -# # -# Wrapper for 64 bit machines # -################################################################################ - ---source include/have_64bit.inc ---source suite/sys_vars/inc/tmp_table_size_basic.inc - -- cgit v1.2.1 From 20cec8bf8aa3798dede3cd18ba8e06777101eef5 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 5 Dec 2008 19:20:05 +0100 Subject: Bug#39750 -cannot create temp file on Windows. The problem appears often in conjuction with temp files, when temp-pool is used, so that names of temp files are not unique. The reason is that rapid deletiion and creation of fiiles with the same name on Windows is not guaranteed to succeed. File disappears from the file system only when the last handle to it is closed. If for example a virus scanner, a backup or indexing application opens the temp file just before MySQL deletes it, the file will enter "delete pending" state. In this state,it is not possible to open the file , or create a file with the same name (CreateFile returns ERROR_ACCESS_DENED, posix open returns EACESS) Fix (rather a cheap workarounf) is not to use temp-pool when working with temporary files- this will make filenames unique. With this patch , temp- pool setting will be ignored on anything but Linux(the option only made sense for Linux since its invention anyway). --- sql/mysqld.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7ff2b9e7dff..32e0dd1542c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -227,6 +227,12 @@ extern "C" int gethostname(char *name, int namelen); extern "C" sig_handler handle_segfault(int sig); +#if defined(__linux__) +#define ENABLE_TEMP_POOL 1 +#else +#define ENABLE_TEMP_TOOL 0 +#endif + /* Constants */ const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"}; @@ -3398,8 +3404,13 @@ static int init_common_variables(const char *conf_file_name, int argc, sys_var_slow_log_path.value= my_strdup(s, MYF(0)); sys_var_slow_log_path.value_length= strlen(s); +#if (ENABLE_TEMP_POOL) if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1)) return 1; +#else + use_temp_pool= 0; +#endif + if (my_database_names_init()) return 1; @@ -6297,9 +6308,14 @@ log and this option does nothing anymore.", (uchar**) &opt_tc_heuristic_recover, (uchar**) &opt_tc_heuristic_recover, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"temp-pool", OPT_TEMP_POOL, +#if (ENABLE_TEMP_POOL) "Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.", +#else + "This option is ignored on this OS.", +#endif (uchar**) &use_temp_pool, (uchar**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"timed_mutexes", OPT_TIMED_MUTEXES, "Specify whether to time mutexes (only InnoDB mutexes are currently supported)", (uchar**) &timed_mutexes, (uchar**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, -- cgit v1.2.1 From ce942b399500cc8ee1374e95b99c476cf43870ef Mon Sep 17 00:00:00 2001 From: Matthias Leich Date: Mon, 8 Dec 2008 15:36:42 +0100 Subject: Fix for Bug#40904 20 tests in 5.1 are disabled in a bad manner - remove totally wrong (syntax) entries from disabled.def - remove entries belonging to deleted tests from disabled.def - correct the comments (correct the bug mentioned) of entries in disabled.def - remove never completed tests which were accidently pushed --- mysql-test/suite/funcs_2/t/disabled.def | 8 +- mysql-test/suite/ndb/t/disabled.def | 3 +- mysql-test/suite/parts/r/partition_bit_ndb.result | 126 ------- mysql-test/suite/parts/t/disabled.def | 5 - mysql-test/suite/parts/t/partition_bit_ndb.test | 60 ---- mysql-test/suite/parts/t/partition_sessions.test | 391 --------------------- .../suite/parts/t/partition_value_innodb.test | 12 +- .../suite/parts/t/partition_value_myisam.test | 12 +- mysql-test/suite/parts/t/partition_value_ndb.test | 12 +- mysql-test/suite/rpl_ndb/t/disabled.def | 4 +- mysql-test/t/disabled.def | 3 +- 11 files changed, 35 insertions(+), 601 deletions(-) delete mode 100644 mysql-test/suite/parts/r/partition_bit_ndb.result delete mode 100644 mysql-test/suite/parts/t/partition_bit_ndb.test delete mode 100644 mysql-test/suite/parts/t/partition_sessions.test diff --git a/mysql-test/suite/funcs_2/t/disabled.def b/mysql-test/suite/funcs_2/t/disabled.def index c903662e052..da6230bd7ed 100644 --- a/mysql-test/suite/funcs_2/t/disabled.def +++ b/mysql-test/suite/funcs_2/t/disabled.def @@ -1,6 +1,6 @@ # Disabled by hhunger (2008-03-03) due to WL4204 -innodb_charset : Due to bug#20447 -myisam_charset : Due to bug#20477 -memory_charset : Due to bug#20447 -ndb_charset : Due to bug#20447 +innodb_charset : Bug#20447 Problem with prefix keys with contractions and expansions +myisam_charset : Bug#20447 Problem with prefix keys with contractions and expansions +memory_charset : Bug#20447 Problem with prefix keys with contractions and expansions +ndb_charset : Bug#20447 Problem with prefix keys with contractions and expansions diff --git a/mysql-test/suite/ndb/t/disabled.def b/mysql-test/suite/ndb/t/disabled.def index c638c7b4774..0fc9a5d3ad6 100644 --- a/mysql-test/suite/ndb/t/disabled.def +++ b/mysql-test/suite/ndb/t/disabled.def @@ -9,8 +9,7 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table -ndb_partition_error2 : HF is not sure if the test can work as internded on all the platforms +ndb_partition_error2 : Bug#40989 ndb_partition_error2 needs maintenance # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open diff --git a/mysql-test/suite/parts/r/partition_bit_ndb.result b/mysql-test/suite/parts/r/partition_bit_ndb.result deleted file mode 100644 index add3ed394ad..00000000000 --- a/mysql-test/suite/parts/r/partition_bit_ndb.result +++ /dev/null @@ -1,126 +0,0 @@ -SET @max_row = 20; -create table t1 (a bit(65), primary key (a)) partition by key (a); -ERROR 42000: Display width out of range for column 'a' (max = 64) -create table t1 (a bit(0), primary key (a)) partition by key (a); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -drop table t1; -create table t1 (a bit(0), primary key (a)) partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp', -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp'); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/tmp/' INDEX DIRECTORY='/tmp/' -/*!50100 PARTITION BY KEY (a) -(PARTITION pa1 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, - PARTITION pa2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ -drop table t1; -create table t1 (a bit(64), primary key (a)) partition by key (a); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -insert into t1 values -(b'1111111111111111111111111111111111111111111111111111111111111111'), -(b'1000000000000000000000000000000000000000000000000000000000000000'), -(b'0000000000000000000000000000000000000000000000000000000000000001'), -(b'1010101010101010101010101010101010101010101010101010101010101010'), -(b'0101010101010101010101010101010101010101010101010101010101010101'); -select hex(a) from t1; -hex(a) -1 -5555555555555555 -8000000000000000 -AAAAAAAAAAAAAAAA -FFFFFFFFFFFFFFFF -drop table t1; -create table t1 (a bit(64), primary key (a)) partition by key (a)( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/tmp/' INDEX DIRECTORY='/tmp/' -/*!50100 PARTITION BY KEY (a) -(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, - PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, - PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, - PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ -insert into t1 values -(b'1111111111111111111111111111111111111111111111111111111111111111'), -(b'1000000000000000000000000000000000000000000000000000000000000000'), -(b'0000000000000000000000000000000000000000000000000000000000000001'), -(b'1010101010101010101010101010101010101010101010101010101010101010'), -(b'0101010101010101010101010101010101010101010101010101010101010101'); -select hex(a) from t1; -hex(a) -1 -5555555555555555 -8000000000000000 -AAAAAAAAAAAAAAAA -FFFFFFFFFFFFFFFF -drop table t1; -create table t1 (a bit, primary key (a)) partition by key (a); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -insert into t1 values (b'0'), (b'1'); -select hex(a) from t1; -hex(a) -0 -1 -alter table t1 drop primary key; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0' -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -select hex(a) from t1; -hex(a) -0 -1 -alter table t1 add primary key (a); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', - PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -select hex(a) from t1; -hex(a) -0 -1 -drop table t1; diff --git a/mysql-test/suite/parts/t/disabled.def b/mysql-test/suite/parts/t/disabled.def index b9cd3462635..518a3c90422 100644 --- a/mysql-test/suite/parts/t/disabled.def +++ b/mysql-test/suite/parts/t/disabled.def @@ -1,8 +1,3 @@ partition_basic_ndb : Bug#19899 Crashing the server # http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-syntax.html -partition_bit_ndb : NDB does not support bit column in index -partition_sessions : needs system_3_init.inc partition_syntax_ndb : Bug#36735 Not supported -partition_value_innodb : Bug#30581 partition_value tests use disallowed CAST() function -partition_value_myisam : Bug#30581 partition_value tests use disallowed CAST() function -partition_value_ndb : Bug#30581 partition_value tests use disallowed CAST() function diff --git a/mysql-test/suite/parts/t/partition_bit_ndb.test b/mysql-test/suite/parts/t/partition_bit_ndb.test deleted file mode 100644 index 227d3d53401..00000000000 --- a/mysql-test/suite/parts/t/partition_bit_ndb.test +++ /dev/null @@ -1,60 +0,0 @@ -################################################################################ -# t/partition_bit_ndb.test # -# # -# Purpose: # -# Tests around bit type # -# NDB branch # -# # -#------------------------------------------------------------------------------# -# Original Author: HH # -# Original Date: 2006-08-01 # -# Change Author: # -# Change Date: # -# Change: # -################################################################################ - -# -# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! -# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN -# THE SOURCED FILES ONLY. -# -# Please read the README at the end of inc/partition.pre before changing -# any of the variables. -# - -#------------------------------------------------------------------------------# -# General not engine specific settings and requirements - -##### Options, for debugging support ##### -let $debug= 0; -let $with_partitioning= 1; - -##### Option, for displaying files ##### -let $ls= 1; - -##### Number of rows for the INSERT/UPDATE/DELETE/SELECT experiments ##### -# on partioned tables -SET @max_row = 20; - -# The server must support partitioning. ---source include/have_partition.inc - -#------------------------------------------------------------------------------# -# Engine specific settings and requirements - -##### Storage engine to be tested ---source include/have_ndb.inc -let $engine= 'NDB'; -connection default; - -# range, list and hash partitioning in ndb requires new_mode ---disable_query_log -set new=on; ---enable_query_log -##### Assign a big number smaller than the maximum value for partitions ##### -# and smaller than the maximum value of SIGNED INTEGER -let $MAX_VALUE= (2147483646); - -#------------------------------------------------------------------------------# -# Execute the tests to be applied to all storage engines ---source suite/parts/inc/partition_bit.inc diff --git a/mysql-test/suite/parts/t/partition_sessions.test b/mysql-test/suite/parts/t/partition_sessions.test deleted file mode 100644 index 3d59292bee5..00000000000 --- a/mysql-test/suite/parts/t/partition_sessions.test +++ /dev/null @@ -1,391 +0,0 @@ - -#-------------------------------------------------- -# Initialize system_3 test variables -#-------------------------------------------------- - ---source suite/system_3/include/system_3_init.inc - -let $NUM_VAL=`SELECT @NUM_VAL`; -let $LOAD_LINES=`SELECT @LOAD_LINES`; -let $LOG_UPPER=`SELECT @LOG_UPPER`; -let $LOG_LOWER=`SELECT @LOG_LOWER`; -#let $ENG1=`SELECT @ENG1`; -let $ENG2=`SELECT @ENG2`; -let $ENG_LOG=`SELECT @ENG_LOG`; -let $CLIENT_HOST=`SELECT @CLIENT_HOST`; -let $ENG=innodb; -let $ENG1=innodb; -#--------------------------------------------------------- -# Column list with definition for all tables to be checked -#--------------------------------------------------------- - -let $column_list= f1 int, -f2 char (15), -f3 decimal (5,3), -f4 datetime; - -let $col_access_list = f1,f2,f3,f4 ; -let $col_new_list = new.f1,new.f2,new.f3 new.f4 ; - -#--------------------------------------------------- -# Setting the parameters to use during testing -#--------------------------------------------------- -# Set number of variations of the f1 variable (used to segment the rows -# being updated/deleted by a user at a time. The higher the number, the -# more smaller segments used with each query. ---replace_result $NUM_VAL NUM_VAL -eval set @f1_nums=$NUM_VAL; - -# The following sets the number controls the size of the log table. -# Once a size of '@threshold' is reached, the first rows are removed -# sunch that the table is down to '@shrink_to' lines ---replace_result $LOG_LOWER LOG_LOWER -eval set @shrink_to=$LOG_LOWER; ---replace_result $LOG_UPPER LOG_UPPER -eval set @threshold=$LOG_UPPER; - -#--------------------------------------------------- -# Creating the database tables and loading the data -#--------------------------------------------------- - ---disable_warnings -drop database if exists systest1; ---enable_warnings - -create database systest1; - ---disable_abort_on_error ---replace_result $CLIENT_HOST CLIENT_HOST -eval create user systuser@'$CLIENT_HOST'; ---enable_abort_on_error ---replace_result $CLIENT_HOST CLIENT_HOST -eval set password for systuser@'$CLIENT_HOST' = password('systpass'); ---replace_result $CLIENT_HOST CLIENT_HOST -eval grant ALL on systest1.* to systuser@'$CLIENT_HOST'; -use systest1; ---replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK -connect (systuser,localhost,systuser,systpass,systest1,$MASTER_MYPORT,$MASTER_MYSOCK); - -create table tb1_master ( - f1 int, - f2 char(15), - f3 decimal (5,3), - f4 datetime -); - -#--replace_result $ENG_LOG ENG_LOG -eval create table tb1_logs ( - i1 int NOT NULL auto_increment, primary key (i1), - dt1 datetime NOT NULL, - entry_dsc char(100), - f4 int -) engine=$ENG_LOG -; -#PARTITION BY HASH (i1) PARTITIONS 8; - -if ($debug) -{ -SHOW CREATE TABLE tb1_logs; -} - -#--replace_result $ENG_LOG ENG_LOG -eval create table ddl_logs ( - i1 int NOT NULL auto_increment, primary key (i1), - dt1 datetime NOT NULL, - entry_dsc char(100), - errno int -) engine=$ENG_LOG; -#PARTITION BY HASH (i1) PARTITIONS 8; - -if ($debug) -{ -SHOW CREATE TABLE tb1_logs; -} -create table test_stat ( - dt1 datetime, - table_name char(20), - row_count int, - start_row int, - end_row int -); - -#---------------------------------------------------------------------- -# tb3_eng1: key partitioning -#---------------------------------------------------------------------- - -#--replace_result $ENG1 ENG1 -eval create table tb3_eng1 ( - i1 int NOT NULL auto_increment, primary key (i1), - $column_list -) engine=$ENG1 -PARTITION BY KEY (i1) PARTITIONS 4 -(PARTITION part1, -PARTITION part2, -PARTITION part3, -PARTITION part4); - -#--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR -eval load data local infile '$MYSQL_TEST_DIR/suite/system_3/data/tb1.txt' - into table tb3_eng1 ($col_access_list); - -if ($WITH_TRIGGERS) -{ -delimiter //; - -Create trigger tb3_eng1_ins after insert on tb3_eng1 for each row -BEGIN - insert into tb1_logs (dt1, entry_dsc, f4) - values (now(), concat('Insert row ', new.f1,' ', - new.f2, ' ', new.f3, ' (tb3_eng1)'), new.f1); -END// - -Create trigger tb3_eng1_upd after update on tb3_eng1 for each row -BEGIN - insert into tb1_logs (dt1, entry_dsc, f4) - values (now(), concat('Update row ', old.f1,' ', old.f2, '->', - new.f2, ' ', old.f3, '->', new.f3, ' (tb3_eng1)'), new.f1); -END// - -Create trigger tb3_eng1_del after delete on tb3_eng1 for each row -BEGIN - insert into tb1_logs (dt1, entry_dsc, f4) - values (now(), concat('Delete row ', old.f1,' ', old.f2, ' ', - old.f3, ' (tb3_eng1)'), old.f1); -END// - -delimiter ;// -} -delimiter //; - -# This functions returns a random integer number -# between zero and 'num' -#----------------------------------------------- -create function int_rand(num int) returns int -BEGIN - return round(num*rand()+0.5); -END// - -# This function returns a string in the length 'len' of -# random letters (ascii range of 65-122) -#------------------------------------------------------ -create function str_rand (len int) returns char(12) -BEGIN - declare tmp_letter char(1); - declare tmp_word char(12); - declare word_str char(12) default ''; - wl_loop: WHILE len DO - set tmp_letter=char(round(57*rand()+65)); - set tmp_word=concat(word_str,tmp_letter); - set word_str=tmp_word; - set len=len-1; - END WHILE wl_loop; - return word_str; -END// - - -# This procedure scans 'tb1_master' table for rows where f1='num_pr' -# and for each row inserts a row in 'tb3_eng1' -#------------------------------------------------------------------ -eval create procedure ins_tb3_eng1 (num_pr int, str_pr char(15)) -BEGIN - declare done int default 0; - declare v3 decimal(5,3); - declare cur1 cursor for - select f3 from tb1_master where f1=num_pr; - declare continue handler for sqlstate '01000' set done = 1; - declare continue handler for sqlstate '02000' set done = 1; - open cur1; - fetch cur1 into v3; - wl_loop: WHILE NOT done DO - insert into tb3_eng1 ($col_access_list) values - (int_rand(@f1_nums), concat('I:',str_pr,'-',num_pr), v3, now()); - fetch cur1 into v3; - END WHILE wl_loop; - close cur1; -END// - - -# This procedure does selects from the 'tb1_logs' and inserts the -# count into the table -#------------------------------------------------------------------ -create procedure slct_tb1_logs () -BEGIN - declare done int default 0; - declare v4 int; - declare v_count int default 0; - declare str_val char(15) default ELT(int_rand(3), - 'Insert', 'Update', 'Delete'); - declare cur1 cursor for - select f4 from tb1_logs where entry_dsc like concat('%',str_val,'%'); - declare continue handler for sqlstate '01000' set done = 1; - declare continue handler for sqlstate '02000' set done = 1; - open cur1; - fetch cur1 into v4; - wl_loop: WHILE NOT done DO - set v_count=v_count+1; - fetch cur1 into v4; - END WHILE wl_loop; - close cur1; - insert into tb1_logs (dt1, entry_dsc, f4) - values (now(), concat('Number of \'', str_val, '\' rows is: ', - v_count, ' (tb1_log)'),0); -END// - -delimiter ;// - ---disable_abort_on_error -insert into systest1.tb3_eng1 values (NULL,50,'init_val',12.345,'2005-01-01 00:00:00'); -insert into systest1.tb3_eng1 values (NULL,70,'init_val',12.345,'2005-01-01 00:00:00'); ---enable_abort_on_error - -connection default;0. ---disable_abort_on_error ---replace_result $CLIENT_HOST CLIENT_HOST -eval create user syst1user@'$CLIENT_HOST'; ---enable_abort_on_error ---replace_result $CLIENT_HOST CLIENT_HOST -eval set password for syst1user@'$CLIENT_HOST' = password('systpass'); ---replace_result $CLIENT_HOST CLIENT_HOST -eval grant ALL on systest1.* to syst1user@'$CLIENT_HOST'; -use systest1; ---replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK -connect (syst1user,localhost,syst1user,systpass,systest1,$MASTER_MYPORT,$MASTER_MYSOCK); - ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval SET @f1_nums=$NUM_VAL; -SET @tmp_num=int_rand(@f1_nums); -SET @tmp_word=str_rand(4); - -# DEBUG select @tmp_num, @tmp_word; - -# Insert rows replacing the deleted rows using a strored procedure -# that reads the rows from a master table -CALL ins_tb3_eng1 (@tmp_num, @tmp_word); - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval SET @f1_nums=$NUM_VAL; -SET @tmp_num=int_rand(@f1_nums); -SET @tmp_word=str_rand(4); - -# DEBUG select @tmp_num, @tmp_word; - -# Insert rows replacing the deleted rows using a strored procedure -# that reads the rows from a master table -CALL ins_tb3_eng1 (@tmp_num, @tmp_word); - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -call slct_tb1_logs(); - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -set @tmp_word=str_rand(4); - -select @tmp_num, @tmp_word; - -# Update all rows in the table where f1 is one less the random number -update tb3_eng1 - set f2=concat('U:',@tmp_word,'-',@tmp_num), f3=f3+1 - where f1=@tmp_num-1; - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -set @tmp_word=str_rand(4); - -select @tmp_num, @tmp_word; - -# Update all rows in the table where f1 is one less the random number -update tb3_eng1 - set f2=concat('U:',@tmp_word,'-',@tmp_num), f3=f3+1 - where f1=@tmp_num-1; - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -call slct_tb1_logs(); - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -set @tmp_word=str_rand(4); - -select @tmp_num, @tmp_word; - -# Update all rows in the table where f1 is one less the random number -update tb3_eng1 - set f2=concat('U:',@tmp_word,'-',@tmp_num), f3=f3+1 - where f1=@tmp_num-1; - - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -#--replace_result $NUM_VAL -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -select @tmp_num; - -# DEBUG select @tmp_num, @tmp_word; - -# Delete all rows from the table where f1 is equal to the above number -delete from tb3_eng1 where f1=@tmp_num; - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -select * from tb3_eng1 where f1>40; - - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -select @tmp_num; - -# DEBUG select @tmp_num, @tmp_word; - -# Delete all rows from the table where f1 is equal to the above number -delete from tb3_eng1 where f1=@tmp_num; - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -select * from tb3_eng1 where f1>40; - -connection syst1user; ---source suite/system_3/include/system_3_init.inc -use systest1; -let $NUM_VAL=`SELECT @NUM_VAL`; -eval set @f1_nums=$NUM_VAL; -set @tmp_num=int_rand(@f1_nums); -select @tmp_num; - -select @tmp_num, @tmp_word; - -# Delete all rows from the table where f1 is equal to the above number -delete from tb3_eng1 where f1=@tmp_num; - -connection systuser; ---source suite/system_3/include/system_3_init.inc -use systest1; -select * from tb3_eng1 where f1>40; diff --git a/mysql-test/suite/parts/t/partition_value_innodb.test b/mysql-test/suite/parts/t/partition_value_innodb.test index 9d59533a54e..fe47f533107 100644 --- a/mysql-test/suite/parts/t/partition_value_innodb.test +++ b/mysql-test/suite/parts/t/partition_value_innodb.test @@ -8,9 +8,9 @@ #------------------------------------------------------------------------------# # Original Author: mleich # # Original Date: 2006-04-11 # -# Change Author: # -# Change Date: # -# Change: # +# Change Author: mleich # +# Change Date: 2008-12-08 # +# Change: Remove test from disabled.def + change test that it gets skipped # ################################################################################ # @@ -22,6 +22,12 @@ # any of the variables. # +# +# CAST() within the partitioning function si no more supported, but we get +# this functionality probably soon again. Therefor we do not delete this test. +--skip # CAST() in partitioning function is currently not supported. + + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_value_myisam.test b/mysql-test/suite/parts/t/partition_value_myisam.test index d6020669509..026ad57f0b2 100644 --- a/mysql-test/suite/parts/t/partition_value_myisam.test +++ b/mysql-test/suite/parts/t/partition_value_myisam.test @@ -8,9 +8,9 @@ #------------------------------------------------------------------------------# # Original Author: mleich # # Original Date: 2006-04-11 # -# Change Author: # -# Change Date: # -# Change: # +# Change Author: mleich # +# Change Date: 2008-12-08 # +# Change: Remove test from disabled.def + change test that it gets skipped # ################################################################################ # @@ -22,6 +22,12 @@ # any of the variables. # +# +# CAST() within the partitioning function si no more supported, but we get +# this functionality probably soon again. Therefor we do not delete this test. +--skip # CAST() in partitioning function is currently not supported. + + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/parts/t/partition_value_ndb.test b/mysql-test/suite/parts/t/partition_value_ndb.test index 2f948b95727..80b4ba6fb64 100644 --- a/mysql-test/suite/parts/t/partition_value_ndb.test +++ b/mysql-test/suite/parts/t/partition_value_ndb.test @@ -8,9 +8,9 @@ #------------------------------------------------------------------------------# # Original Author: mleich # # Original Date: 2006-04-11 # -# Change Author: # -# Change Date: # -# Change: # +# Change Author: mleich # +# Change Date: 2008-12-08 # +# Change: Remove test from disabled.def + change test that it gets skipped # ################################################################################ # @@ -22,6 +22,12 @@ # any of the variables. # +# +# CAST() within the partitioning function si no more supported, but we get +# this functionality probably soon again. Therefor we do not delete this test. +--skip # CAST() in partitioning function is currently not supported. + + #------------------------------------------------------------------------------# # General not engine specific settings and requirements diff --git a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def index ebc99feeac6..694f7098980 100644 --- a/mysql-test/suite/rpl_ndb/t/disabled.def +++ b/mysql-test/suite/rpl_ndb/t/disabled.def @@ -10,7 +10,7 @@ # ############################################################################## -rpl_ndb_circular : Bug#33849 COMMIT event missing in cluster circular replication. -rpl_ndb_circular_simplex : Bug#33849 COMMIT event missing in cluster circular replication. +rpl_ndb_circular : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash +rpl_ndb_circular_simplex : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 5de0a435ba5..e2a4d0ba33d 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -10,6 +10,5 @@ # ############################################################################## federated_transactions : Bug#29523 Transactions do not work -log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows -slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions +slow_query_log_func : Bug #37962: *_func tests containing sleeps/race conditions wait_timeout_func : Bug #41225 joro wait_timeout_func fails -- cgit v1.2.1 From 255418d9789e45c86fd8481b33b48309dce2d27f Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Mon, 8 Dec 2008 17:07:08 +0200 Subject: Bug #40221 Replication failure on RBR + UPDATE the primary key Extending bug#40221 regression test: 1. include INSERT 2. convert prim key + autoinc to unique. mysql-test/suite/binlog/r/binlog_innodb_row.result: results changed. mysql-test/suite/binlog/t/binlog_innodb_row.test: Extending bug#40221 regression test to include the INSERT dup key errored-out case. --- mysql-test/suite/binlog/r/binlog_innodb_row.result | 27 ++++++++++++++-------- mysql-test/suite/binlog/t/binlog_innodb_row.test | 22 +++++++++++++++--- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_innodb_row.result b/mysql-test/suite/binlog/r/binlog_innodb_row.result index 47ddcbd00f6..fab79c4bc2f 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb_row.result +++ b/mysql-test/suite/binlog/r/binlog_innodb_row.result @@ -1,16 +1,10 @@ -CREATE TABLE t1 (pk int auto_increment primary key) ENGINE=innodb; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `pk` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`pk`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE t1 (i int unique) ENGINE=innodb; reset master; begin; insert into t1 values (1),(2); *** the following UPDATE query wont generate any updates for the binlog *** -update t1 set pk = 3 where pk < 3; -ERROR 23000: Duplicate entry '3' for key 'PRIMARY' +update t1 set i = 3 where i < 3; +ERROR 23000: Duplicate entry '3' for key 'i' commit; *** Results of the test: the binlog must have only Write_rows events not any Update_rows *** show binlog events from ; @@ -19,4 +13,19 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +delete from t1; +reset master; +begin; +insert into t1 values (1),(2); +*** the following UPDATE query wont generate any updates for the binlog *** +insert into t1 values (3),(4),(1),(2); +ERROR 23000: Duplicate entry '1' for key 'i' +commit; +*** Results of the test: the binlog must have only one Write_rows event not two *** +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ drop table t1; diff --git a/mysql-test/suite/binlog/t/binlog_innodb_row.test b/mysql-test/suite/binlog/t/binlog_innodb_row.test index 7f42f5b95cb..aaba98e3284 100644 --- a/mysql-test/suite/binlog/t/binlog_innodb_row.test +++ b/mysql-test/suite/binlog/t/binlog_innodb_row.test @@ -9,18 +9,34 @@ source include/have_binlog_format_row.inc; # Bug #40221 Replication failure on RBR + UPDATE the primary key # -CREATE TABLE t1 (pk int auto_increment primary key) ENGINE=innodb; -show create table t1; +CREATE TABLE t1 (i int unique) ENGINE=innodb; reset master; +# part 1: update can cause the dup key + begin; insert into t1 values (1),(2); --echo *** the following UPDATE query wont generate any updates for the binlog *** --error ER_DUP_ENTRY -update t1 set pk = 3 where pk < 3; +update t1 set i = 3 where i < 3; commit; --echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows *** source include/show_binlog_events.inc; +# part 2: insert can cause the dup key + +delete from t1; +reset master; + +begin; +insert into t1 values (1),(2); +--echo *** the following UPDATE query wont generate any updates for the binlog *** +--error ER_DUP_ENTRY +insert into t1 values (3),(4),(1),(2); +commit; + +--echo *** Results of the test: the binlog must have only one Write_rows event not two *** +source include/show_binlog_events.inc; + drop table t1; -- cgit v1.2.1 From 482fa1f1748c960326aa2cf5d0f95c18061ea138 Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Mon, 8 Dec 2008 12:45:48 -0500 Subject: Replace C++ comment in a header file. Thanks, Alik! --- extra/yassl/include/openssl/ssl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index de09f1ebe4b..05b34a0dc45 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -203,8 +203,8 @@ SSL_CTX* SSL_CTX_new(SSL_METHOD*); SSL* SSL_new(SSL_CTX*); int SSL_set_fd (SSL*, YASSL_SOCKET_T); YASSL_SOCKET_T SSL_get_fd(const SSL*); -int SSL_connect(SSL*); // if you get an error from connect - // see note at top of REAMDE +int SSL_connect(SSL*); /* if you get an error from connect + see note at top of REAMDE */ int SSL_write(SSL*, const void*, int); int SSL_read(SSL*, void*, int); int SSL_accept(SSL*); -- cgit v1.2.1 From ed7b41d60e3c611cb806b0fd0184895d4f049ea1 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Mon, 8 Dec 2008 21:40:25 +0200 Subject: Bug #33420 Test 'rpl_packet' fails randomly with changed "Exec_Master_Log_Pos" binlog_row_mix_innodb_myisam resutls are corrected. The last operations prior the dup error is TRUNCATE table t2; Therefore after --error ER_DUP_ENTRY INSERT INTO t2 select * from t1; table t2 must be empty, and that is what the updated results confirm. mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: results changed due to Bug #33420 fixing. --- mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result | 2 -- 1 file changed, 2 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index 0b33d71b6f1..dcad7e022b7 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -385,8 +385,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE t2 master-bin.000001 # Query # # use `test`; BEGIN -- cgit v1.2.1 From 695a2fd90ea100375ed76d96c0c296ad1f474d01 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Tue, 9 Dec 2008 11:05:36 +0300 Subject: Fixed type_float failures in --ps-protocol mode introduced by the test case for bug #27483. The reason for the failures was bug #21205 (fixed in 6.0 by dtoa, but still present in 5.0/5.1). mysql-test/r/type_float.result: Modified the failing test case so that bug #21205 does not occur. mysql-test/t/type_float.test: Modified the failing test case so that bug #21205 does not occur. --- mysql-test/r/type_float.result | 12 ++++++------ mysql-test/t/type_float.test | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index e7f17bd75a7..d86c515062a 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -398,11 +398,11 @@ insert into t1(d) values (9.2233720368547777e+18), (9.22337203685479e18), (1.84e19); update t1 set u = d; -select * from t1; -d u -9.22337203685478e+18 9223372036854775808 -9.22337203685478e+18 9223372036854779904 -9.22337203685479e+18 9223372036854790144 -1.84e+19 18400000000000000000 +select u from t1; +u +9223372036854775808 +9223372036854779904 +9223372036854790144 +18400000000000000000 drop table t1; End of 5.0 tests diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index b23755b44fb..3ceef129912 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -265,7 +265,7 @@ insert into t1(d) values (9.2233720368547777e+18), (1.84e19); update t1 set u = d; -select * from t1; +select u from t1; drop table t1; -- cgit v1.2.1 From 9b6a09d1554c11a1c9fe86be3c459d8f7bceba7c Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 9 Dec 2008 12:30:49 +0400 Subject: Bug#35934 mysql_upgrade calls mysqlcheck with insufficient parameters modifying the original fix. As it turned out --fix-db-names option of the mysqlcheck suppress the --check_upgrade option, so we have to call the mysqlcheck twice from the mysql_upgrade. per-file comments: client/mysql_upgrade.c Bug#35934 mysql_upgrade calls mysqlcheck with insufficient parameters --- client/mysql_upgrade.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index e1fc4caf720..190bb2383e9 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -616,6 +616,18 @@ static int run_mysqlcheck_upgrade(void) "--check-upgrade", "--all-databases", "--auto-repair", + NULL); +} + + +static int run_mysqlcheck_fixnames(void) +{ + verbose("Running 'mysqlcheck'..."); + return run_tool(mysqlcheck_path, + NULL, /* Send output from mysqlcheck directly to screen */ + "--no-defaults", + ds_args.str, + "--all-databases", "--fix-db-names", "--fix-table-names", NULL); @@ -784,7 +796,8 @@ int main(int argc, char **argv) /* Run "mysqlcheck" and "mysql_fix_privilege_tables.sql" */ - if (run_mysqlcheck_upgrade() || + if (run_mysqlcheck_fixnames() || + run_mysqlcheck_upgrade() || run_sql_fix_privilege_tables()) { /* -- cgit v1.2.1 From 0d2db9c02023c5867e92c31c53da9c5431042387 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 9 Dec 2008 13:04:28 +0400 Subject: Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table. reset diagnostics area state after error message is sent mysql-test/r/myisampack.result: test result mysql-test/t/myisampack.test: test case sql/sql_table.cc: reset diagnostics area state after error message is sent --- mysql-test/r/myisampack.result | 22 ++++++++++++++++++++++ mysql-test/t/myisampack.test | 25 +++++++++++++++++++++++++ sql/sql_table.cc | 1 + 3 files changed, 48 insertions(+) diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result index 5f39d318234..14b6283bf8f 100644 --- a/mysql-test/r/myisampack.result +++ b/mysql-test/r/myisampack.result @@ -27,3 +27,25 @@ CHECK TABLE t1 EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +drop table if exists t1; +create table t1(f1 int, f2 varchar(255)); +insert into t1 values(1, 'foo'), (2, 'bar'); +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +flush tables; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize error Table 'test.t1' is read only +Warnings: +Error 1036 Table 't1' is read only +drop table t1; diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test index 6598af6318a..99767f81033 100644 --- a/mysql-test/t/myisampack.test +++ b/mysql-test/t/myisampack.test @@ -31,3 +31,28 @@ FLUSH TABLES; --exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1 CHECK TABLE t1 EXTENDED; DROP TABLE t1; + +# +# Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table. +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1(f1 int, f2 varchar(255)); +insert into t1 values(1, 'foo'), (2, 'bar'); +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +insert into t1 select * from t1; +flush tables; +--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1 +optimize table t1; +drop table t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index ec35616bc89..16d420441d1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4319,6 +4319,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, table->table=0; // For query cache if (protocol->write()) goto err; + thd->main_da.reset_diagnostics_area(); continue; /* purecov: end */ } -- cgit v1.2.1 From cbb368aa889ad5243db2e3c486555570dbb8c494 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 9 Dec 2008 13:53:23 +0400 Subject: Bug#35796 SHOW CREATE TABLE and default value for BIT field show default value for BIT field in printable format mysql-test/r/type_bit.result: Bug#35796 SHOW CREATE TABLE and default value for BIT field test result mysql-test/t/type_bit.test: Bug#35796 SHOW CREATE TABLE and default value for BIT field test case sql/item.cc: Bug#35796 SHOW CREATE TABLE and default value for BIT field issue an error if BIN|HEX deafult value is empty value (behaviour like for INT fields) --- mysql-test/r/type_bit.result | 15 +++++++++++++++ mysql-test/t/type_bit.test | 15 +++++++++++++++ sql/item.cc | 3 +++ sql/sql_show.cc | 18 +++++++++++++++--- 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 68c0e1635a3..2a83d9b4c62 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -708,4 +708,19 @@ HEX(b1) HEX(b2) i2 1 0 100 1 0 200 DROP TABLE t1, t2; +CREATE TABLE IF NOT EXISTS t1 ( +f1 bit(2) NOT NULL default b'10', +f2 bit(14) NOT NULL default b'11110000111100' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` bit(2) NOT NULL default b'10', + `f2` bit(14) NOT NULL default b'11110000111100' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci +DROP TABLE t1; +CREATE TABLE IF NOT EXISTS t1 ( +f1 bit(2) NOT NULL default b'' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +ERROR 42000: Invalid default value for 'f1' End of 5.0 tests diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index 6a6b29deda4..81dca17f112 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -352,4 +352,19 @@ SELECT HEX(b1), HEX(b2), i2 FROM t2 DROP TABLE t1, t2; +# +# Bug #35796 SHOW CREATE TABLE and default value for BIT field +# +CREATE TABLE IF NOT EXISTS t1 ( +f1 bit(2) NOT NULL default b'10', +f2 bit(14) NOT NULL default b'11110000111100' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error ER_INVALID_DEFAULT +CREATE TABLE IF NOT EXISTS t1 ( +f1 bit(2) NOT NULL default b'' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + --echo End of 5.0 tests diff --git a/sql/item.cc b/sql/item.cc index 182f4abdfe6..243c22bb7e6 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4950,6 +4950,9 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions) ulonglong nr; uint32 length= str_value.length(); + if (!length) + return 1; + if (length > 8) { nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 4e3d209f674..59082e0a295 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -798,7 +798,7 @@ static bool get_field_default_value(THD *thd, TABLE *table, { bool has_default; bool has_now_default; - + enum enum_field_types field_type= field->type(); /* We are using CURRENT_TIMESTAMP instead of NOW because it is more standard @@ -806,7 +806,7 @@ static bool get_field_default_value(THD *thd, TABLE *table, has_now_default= table->timestamp_field == field && field->unireg_check != Field::TIMESTAMP_UN_FIELD; - has_default= (field->type() != FIELD_TYPE_BLOB && + has_default= (field_type != FIELD_TYPE_BLOB && !(field->flags & NO_DEFAULT_VALUE_FLAG) && field->unireg_check != Field::NEXT_NUMBER && !((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) @@ -821,7 +821,19 @@ static bool get_field_default_value(THD *thd, TABLE *table, { // Not null by default char tmp[MAX_FIELD_WIDTH]; String type(tmp, sizeof(tmp), field->charset()); - field->val_str(&type); + if (field_type == MYSQL_TYPE_BIT) + { + longlong dec= field->val_int(); + char *ptr= longlong2str(dec, tmp + 2, 2); + uint32 length= (uint32) (ptr - tmp); + tmp[0]= 'b'; + tmp[1]= '\''; + tmp[length]= '\''; + type.length(length + 1); + quoted= 0; + } + else + field->val_str(&type); if (type.length()) { String def_val; -- cgit v1.2.1 From 681a2d1a53999f70e5437f62d8478caade48f3b3 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 9 Dec 2008 14:00:43 +0400 Subject: bug#35558 Wrong server metadata blows up the client the problem: FORMAT func max_length value was calculated incorrectly the fix: correct calculation of max_length mysql-test/r/func_str.result: test result mysql-test/t/func_str.test: test case sql/item_strfunc.h: the problem: FORMAT func max_length value was calculated incorrectly the fix: correct calculation of max_length --- mysql-test/r/func_str.result | 12 +++++++++--- mysql-test/t/func_str.test | 10 ++++++++++ sql/item_strfunc.h | 5 +++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index d0809eca65b..c121c8937d7 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -717,8 +717,6 @@ insert(_latin2'abcd',2,3,_latin2'ef'), replace(_latin2'abcd',_latin2'b',_latin2'B'), encode('abcd','ab') ; -Warnings: -Warning 1265 Data truncated for column 'format(130,10)' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -727,7 +725,7 @@ t1 CREATE TABLE `t1` ( `conv(130,16,10)` varchar(64) default NULL, `hex(130)` varchar(6) NOT NULL default '', `char(130)` varbinary(4) NOT NULL default '', - `format(130,10)` varchar(4) NOT NULL default '', + `format(130,10)` varchar(16) NOT NULL default '', `left(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '', `right(_latin2'a',1)` varchar(1) character set latin2 NOT NULL default '', `lcase(_latin2'a')` varchar(1) character set latin2 NOT NULL default '', @@ -2175,4 +2173,12 @@ SELECT HEX(c1) from v1; HEX(c1) 414243 DROP VIEW v1; +create table t1(a float); +insert into t1 values (1.33); +select format(a, 2) from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def format(a, 2) 253 20 4 Y 0 2 8 +format(a, 2) +1.33 +drop table t1; End of 5.0 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 1ca2bbfaf4c..8298a50c277 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1149,4 +1149,14 @@ CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1; SELECT HEX(c1) from v1; DROP VIEW v1; +# +# Bug #35558 Wrong server metadata blows up the client +# +create table t1(a float); +insert into t1 values (1.33); +--enable_metadata +select format(a, 2) from t1; +--disable_metadata +drop table t1; + --echo End of 5.0 tests diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 3648438a69b..23ac20a4017 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -516,8 +516,9 @@ public: { collation.set(default_charset()); uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen; - max_length= ((char_length + (char_length-args[0]->decimals)/3) * - collation.collation->mbmaxlen); + uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1; + max_length= (char_length + max_sep_count + decimals) * + collation.collation->mbmaxlen; } const char *func_name() const { return "format"; } void print(String *); -- cgit v1.2.1 From 06c4ff1c13f381130c264ba72f13009cc60528f6 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Tue, 9 Dec 2008 13:19:46 +0300 Subject: Added a missing bit from the original patch for bug #27483 which was lost when re-applying the patch manually to another tree. --- sql/field.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/field.cc b/sql/field.cc index 8188b51d4d1..f8ab4b852ec 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3473,7 +3473,7 @@ int Field_longlong::store(double nr) error= 1; } else - res=(longlong) (ulonglong) nr; + res=(longlong) double2ulonglong(nr); } else { -- cgit v1.2.1 From d3b3778477be60251a41b8ef5b25385e5575fae3 Mon Sep 17 00:00:00 2001 From: Leonard Zhou Date: Tue, 9 Dec 2008 18:52:10 +0800 Subject: BUG#27477 Remove tmp-directory on MTR start mysql-test/mysql-test-run.pl: Remove tmp-directory on MTR start --- mysql-test/mysql-test-run.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b342421ca2e..20a0b639e84 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2386,6 +2386,9 @@ sub remove_stale_vardir () { mtr_verbose("Removing $opt_vardir/"); mtr_rmtree("$opt_vardir/"); } + # Remove the "tmp" dir + mtr_verbose("Removing $opt_tmpdir/"); + mtr_rmtree("$opt_tmpdir/"); } # -- cgit v1.2.1 From 419e053a417f4ec771cc940be3c0b924cd868f9d Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 9 Dec 2008 16:38:52 +0400 Subject: Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types added ability for TINY[MEDIUM] text fields to be converted to greater subtype during alter if necessary(altered charset) mysql-test/r/alter_table.result: test result mysql-test/t/alter_table.test: test case sql/sql_table.cc: added ability for TINY[MEDIUM] text fields to be converted to greater subtype during alter if necessary(altered charset) --- mysql-test/r/alter_table.result | 16 ++++++++++++++++ mysql-test/t/alter_table.test | 13 +++++++++++++ sql/sql_table.cc | 4 +++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 95c652055ec..d81086682f1 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -915,3 +915,19 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +create table t1 (a tinytext character set latin1); +alter table t1 convert to character set utf8; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +drop table t1; +create table t1 (a mediumtext character set latin1); +alter table t1 convert to character set utf8; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longtext +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +drop table t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index bcca122f9f8..18481291bba 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -696,3 +696,16 @@ unlock tables; select * from t1; check table t1; drop table t1; + + +# +# Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types +# +create table t1 (a tinytext character set latin1); +alter table t1 convert to character set utf8; +show create table t1; +drop table t1; +create table t1 (a mediumtext character set latin1); +alter table t1 convert to character set utf8; +show create table t1; +drop table t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8baeca9ccf7..eefe2a5596e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1535,7 +1535,9 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field) if ((sql_field->flags & BLOB_FLAG) && sql_field->length) { - if (sql_field->sql_type == FIELD_TYPE_BLOB) + if (sql_field->sql_type == FIELD_TYPE_BLOB || + sql_field->sql_type == FIELD_TYPE_TINY_BLOB || + sql_field->sql_type == FIELD_TYPE_MEDIUM_BLOB) { /* The user has given a length to the blob column */ sql_field->sql_type= get_blob_type_from_length(sql_field->length); -- cgit v1.2.1 From 4ce563e01cffebebd5c2a436ba67bf54e27f01f4 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 9 Dec 2008 16:59:47 +0400 Subject: Bug#31399 Wrong query result when doing join buffering over BIT fields if table has bit fields then uneven bits(if exist) are stored into null bits place. So we need to copy null bits in case of uneven bit field presence. mysql-test/r/type_bit.result: test result mysql-test/t/type_bit.test: test case sql/sql_select.cc: if table has bit fields then uneven bits(if exist) are stored into null bits place. So we need to copy null bits in case of uneven bit field presence. --- mysql-test/r/type_bit.result | 26 ++++++++++++++++++++++++++ mysql-test/t/type_bit.test | 30 ++++++++++++++++++++++++++++++ sql/sql_select.cc | 8 ++++++-- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 2a83d9b4c62..63dec0297d0 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -723,4 +723,30 @@ CREATE TABLE IF NOT EXISTS t1 ( f1 bit(2) NOT NULL default b'' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; ERROR 42000: Invalid default value for 'f1' +create table t1bit7 (a1 bit(7) not null) engine=MyISAM; +create table t2bit7 (b1 bit(7)) engine=MyISAM; +insert into t1bit7 values (b'1100000'); +insert into t1bit7 values (b'1100001'); +insert into t1bit7 values (b'1100010'); +insert into t2bit7 values (b'1100001'); +insert into t2bit7 values (b'1100010'); +insert into t2bit7 values (b'1100110'); +select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1; +bin(a1) +1100001 +1100010 +drop table t1bit7, t2bit7; +create table t1bit7 (a1 bit(15) not null) engine=MyISAM; +create table t2bit7 (b1 bit(15)) engine=MyISAM; +insert into t1bit7 values (b'110000011111111'); +insert into t1bit7 values (b'110000111111111'); +insert into t1bit7 values (b'110001011111111'); +insert into t2bit7 values (b'110000111111111'); +insert into t2bit7 values (b'110001011111111'); +insert into t2bit7 values (b'110011011111111'); +select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1; +bin(a1) +110000111111111 +110001011111111 +drop table t1bit7, t2bit7; End of 5.0 tests diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index 81dca17f112..bdc678688f1 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -367,4 +367,34 @@ CREATE TABLE IF NOT EXISTS t1 ( f1 bit(2) NOT NULL default b'' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +# +# Bug#31399 Wrong query result when doing join buffering over BIT fields +# +create table t1bit7 (a1 bit(7) not null) engine=MyISAM; +create table t2bit7 (b1 bit(7)) engine=MyISAM; + +insert into t1bit7 values (b'1100000'); +insert into t1bit7 values (b'1100001'); +insert into t1bit7 values (b'1100010'); +insert into t2bit7 values (b'1100001'); +insert into t2bit7 values (b'1100010'); +insert into t2bit7 values (b'1100110'); + +select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1; +drop table t1bit7, t2bit7; + +create table t1bit7 (a1 bit(15) not null) engine=MyISAM; +create table t2bit7 (b1 bit(15)) engine=MyISAM; + +insert into t1bit7 values (b'110000011111111'); +insert into t1bit7 values (b'110000111111111'); +insert into t1bit7 values (b'110001011111111'); +insert into t2bit7 values (b'110000111111111'); +insert into t2bit7 values (b'110001011111111'); +insert into t2bit7 values (b'110011011111111'); + +select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1; +drop table t1bit7, t2bit7; + --echo End of 5.0 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 2ac33c4e07f..b080fff8725 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -13233,6 +13233,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) length=0; for (i=0 ; i < table_count ; i++) { + bool have_bit_fields= FALSE; uint null_fields=0,used_fields; Field **f_ptr,*field; @@ -13247,13 +13248,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) length+=field->fill_cache_field(copy); if (copy->blob_field) (*blob_ptr++)=copy; - if (field->maybe_null()) + if (field->real_maybe_null()) null_fields++; + if (field->type() == MYSQL_TYPE_BIT && + ((Field_bit*)field)->bit_len) + have_bit_fields= TRUE; copy++; } } /* Copy null bits from table */ - if (null_fields && tables[i].table->s->null_fields) + if (null_fields || have_bit_fields) { /* must copy null bits */ copy->str=(char*) tables[i].table->null_flags; copy->length= tables[i].table->s->null_bytes; -- cgit v1.2.1 From 667367780358ac3bba58519b07fe3476923fc4fe Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 9 Dec 2008 19:31:22 +0400 Subject: updated test results mysql-test/suite/parts/r/partition_bit_innodb.result: updated test result mysql-test/suite/parts/r/partition_bit_myisam.result: updated test result --- mysql-test/suite/parts/r/partition_bit_innodb.result | 18 +++++++++--------- mysql-test/suite/parts/r/partition_bit_myisam.result | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mysql-test/suite/parts/r/partition_bit_innodb.result b/mysql-test/suite/parts/r/partition_bit_innodb.result index 2ea66592679..a9ae917f13d 100644 --- a/mysql-test/suite/parts/r/partition_bit_innodb.result +++ b/mysql-test/suite/parts/r/partition_bit_innodb.result @@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='INNODB' partition by key (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */ @@ -18,7 +18,7 @@ partition pa2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -30,7 +30,7 @@ partition by key (a) partitions 2; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', + `a` bit(64) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', + `a` bit(64) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -88,7 +88,7 @@ partition by key (a) partitions 4; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -102,7 +102,7 @@ alter table t2 drop primary key; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0' + `a` bit(1) NOT NULL DEFAULT b'0' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 4 */ @@ -114,7 +114,7 @@ alter table t2 add primary key (a); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -133,7 +133,7 @@ partition pa4 values less than (256)); show create table t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` bit(8) NOT NULL DEFAULT '\0', + `a` bit(8) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) @@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)); show create table t4; Table Create Table t4 CREATE TABLE `t4` ( - `a` bit(8) NOT NULL DEFAULT '\0', + `a` bit(8) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) diff --git a/mysql-test/suite/parts/r/partition_bit_myisam.result b/mysql-test/suite/parts/r/partition_bit_myisam.result index c1f067d80d1..680845c9971 100644 --- a/mysql-test/suite/parts/r/partition_bit_myisam.result +++ b/mysql-test/suite/parts/r/partition_bit_myisam.result @@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='MyISAM' partition by key (a) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) */ @@ -18,7 +18,7 @@ partition pa2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -30,7 +30,7 @@ partition by key (a) partitions 2; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', + `a` bit(64) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', + `a` bit(64) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -88,7 +88,7 @@ partition by key (a) partitions 4; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -102,7 +102,7 @@ alter table t2 drop primary key; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0' + `a` bit(1) NOT NULL DEFAULT b'0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 4 */ @@ -114,7 +114,7 @@ alter table t2 add primary key (a); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` bit(1) NOT NULL DEFAULT '\0', + `a` bit(1) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) @@ -133,7 +133,7 @@ partition pa4 values less than (256)); show create table t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` bit(8) NOT NULL DEFAULT '\0', + `a` bit(8) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) @@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)); show create table t4; Table Create Table t4 CREATE TABLE `t4` ( - `a` bit(8) NOT NULL DEFAULT '\0', + `a` bit(8) NOT NULL DEFAULT b'0', PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) -- cgit v1.2.1 From bd8657786a185fee54cfbc35b7ef5142e8508073 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 9 Dec 2008 19:46:03 +0200 Subject: Bug #37936: ASSERT_COLUMN_MARKED_FOR_WRITE in Field_datetime::store , Field_varstring::store The code that temporary saved the bitmaps of the read set and the write set so that it can set it to all columns for debug purposes was not expecting that the table->read_set and table->write_set can be the same. And was always saving both in sequence. As a result the original value was never restored. Fixed by saving & restoring the original value only once if the two sets are the same (in a special set of functions). mysql-test/r/select.result: Bug #37936: test case mysql-test/t/select.test: Bug #37936: test case sql/item_cmpfunc.cc: Bug #37936: don't save/restore twice if the read and write sets are the same sql/opt_range.cc: Bug #37936: don't save/restore twice if the read and write sets are the same sql/table.h: Bug #37936: Make a designated set of functions that save/restore both the read and the write sets in a single call. --- mysql-test/r/select.result | 26 ++++++++++++++++++++++++++ mysql-test/t/select.test | 33 +++++++++++++++++++++++++++++++++ sql/item_cmpfunc.cc | 18 ++++++------------ sql/opt_range.cc | 26 +++++++++++--------------- sql/table.h | 30 ++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 27 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 4b2464af688..313bc9b9630 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4358,3 +4358,29 @@ a 4 5 DROP TABLE t1; +CREATE TABLE A (date_key date); +CREATE TABLE C ( +pk int, +int_nokey int, +int_key int, +date_key date NOT NULL, +date_nokey date, +varchar_key varchar(1) +); +INSERT INTO C VALUES +(1,1,1,'0000-00-00',NULL,NULL), +(1,1,1,'0000-00-00',NULL,NULL); +SELECT 1 FROM C WHERE pk > ANY (SELECT 1 FROM C); +1 +SELECT COUNT(DISTINCT 1) FROM C +WHERE date_key = (SELECT 1 FROM A WHERE C.date_key IS NULL) GROUP BY pk; +COUNT(DISTINCT 1) +SELECT date_nokey FROM C +WHERE int_key IN (SELECT 1 FROM A) +HAVING date_nokey = '10:41:7' +ORDER BY date_key; +date_nokey +Warnings: +Warning 1292 Incorrect date value: '10:41:7' for column 'date_nokey' at row 1 +DROP TABLE A,C; +End of 5.1 tests diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 30abb797e83..020f94699f9 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3701,3 +3701,36 @@ SELECT a FROM t1 ORDER BY a LIMIT 2; SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296; SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297; DROP TABLE t1; + +# +# Bug #37936: ASSERT_COLUMN_MARKED_FOR_WRITE in Field_datetime::store , +# Field_varstring::store +# + +CREATE TABLE A (date_key date); + +CREATE TABLE C ( + pk int, + int_nokey int, + int_key int, + date_key date NOT NULL, + date_nokey date, + varchar_key varchar(1) +); + +INSERT INTO C VALUES +(1,1,1,'0000-00-00',NULL,NULL), +(1,1,1,'0000-00-00',NULL,NULL); + +SELECT 1 FROM C WHERE pk > ANY (SELECT 1 FROM C); + +SELECT COUNT(DISTINCT 1) FROM C + WHERE date_key = (SELECT 1 FROM A WHERE C.date_key IS NULL) GROUP BY pk; +SELECT date_nokey FROM C + WHERE int_key IN (SELECT 1 FROM A) + HAVING date_nokey = '10:41:7' + ORDER BY date_key; + +DROP TABLE A,C; + +--echo End of 5.1 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index cefa479fea6..564632fbb9b 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -394,19 +394,16 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, TABLE *table= field->table; ulong orig_sql_mode= thd->variables.sql_mode; enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields; - my_bitmap_map *old_write_map; - my_bitmap_map *old_read_map; + my_bitmap_map *old_maps[2]; ulonglong orig_field_val; /* original field value if valid */ - LINT_INIT(old_write_map); - LINT_INIT(old_read_map); + LINT_INIT(old_maps[0]); + LINT_INIT(old_maps[1]); LINT_INIT(orig_field_val); if (table) - { - old_write_map= dbug_tmp_use_all_columns(table, table->write_set); - old_read_map= dbug_tmp_use_all_columns(table, table->read_set); - } + dbug_tmp_use_all_columns(table, old_maps, + table->read_set, table->write_set); /* For comparison purposes allow invalid dates like 2000-01-32 */ thd->variables.sql_mode= (orig_sql_mode & ~MODE_NO_ZERO_DATE) | MODE_INVALID_DATES; @@ -437,10 +434,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, thd->variables.sql_mode= orig_sql_mode; thd->count_cuted_fields= orig_count_cuted_fields; if (table) - { - dbug_tmp_restore_column_map(table->write_set, old_write_map); - dbug_tmp_restore_column_map(table->read_set, old_read_map); - } + dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_maps); } return result; } diff --git a/sql/opt_range.cc b/sql/opt_range.cc index bafc368e415..7d9709909c3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2668,7 +2668,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) PART_PRUNE_PARAM prune_param; MEM_ROOT alloc; RANGE_OPT_PARAM *range_par= &prune_param.range_param; - my_bitmap_map *old_read_set, *old_write_set; + my_bitmap_map *old_sets[2]; prune_param.part_info= part_info; init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0); @@ -2682,8 +2682,8 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) DBUG_RETURN(FALSE); } - old_write_set= dbug_tmp_use_all_columns(table, table->write_set); - old_read_set= dbug_tmp_use_all_columns(table, table->read_set); + dbug_tmp_use_all_columns(table, old_sets, + table->read_set, table->write_set); range_par->thd= thd; range_par->table= table; /* range_par->cond doesn't need initialization */ @@ -2773,8 +2773,7 @@ all_used: retval= FALSE; // some partitions are used mark_all_partitions_as_used(prune_param.part_info); end: - dbug_tmp_restore_column_map(table->write_set, old_write_set); - dbug_tmp_restore_column_map(table->read_set, old_read_set); + dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets); thd->no_errors=0; thd->mem_root= range_par->old_root; free_root(&alloc,MYF(0)); // Return memory & allocator @@ -11145,9 +11144,9 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length) String tmp(buff,sizeof(buff),&my_charset_bin); uint store_length; TABLE *table= key_part->field->table; - my_bitmap_map *old_write_set, *old_read_set; - old_write_set= dbug_tmp_use_all_columns(table, table->write_set); - old_read_set= dbug_tmp_use_all_columns(table, table->read_set); + my_bitmap_map *old_sets[2]; + + dbug_tmp_use_all_columns(table, old_sets, table->read_set, table->write_set); for (; key < key_end; key+=store_length, key_part++) { @@ -11173,8 +11172,7 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length) if (key+store_length < key_end) fputc('/',DBUG_FILE); } - dbug_tmp_restore_column_map(table->write_set, old_write_set); - dbug_tmp_restore_column_map(table->read_set, old_read_set); + dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets); } @@ -11182,18 +11180,16 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg) { char buf[MAX_KEY/8+1]; TABLE *table; - my_bitmap_map *old_read_map, *old_write_map; + my_bitmap_map *old_sets[2]; DBUG_ENTER("print_quick"); if (!quick) DBUG_VOID_RETURN; DBUG_LOCK_FILE; table= quick->head; - old_read_map= dbug_tmp_use_all_columns(table, table->read_set); - old_write_map= dbug_tmp_use_all_columns(table, table->write_set); + dbug_tmp_use_all_columns(table, old_sets, table->read_set, table->write_set); quick->dbug_dump(0, TRUE); - dbug_tmp_restore_column_map(table->read_set, old_read_map); - dbug_tmp_restore_column_map(table->write_set, old_write_map); + dbug_tmp_restore_column_maps(table->read_set, table->write_set, old_sets); fprintf(DBUG_FILE,"other_keys: 0x%s:\n", needed_reg->print(buf)); diff --git a/sql/table.h b/sql/table.h index ccd6b60664e..a89434b23ed 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1692,5 +1692,35 @@ static inline void dbug_tmp_restore_column_map(MY_BITMAP *bitmap, #endif } + +/* + Variant of the above : handle both read and write sets. + Provide for the possiblity of the read set being the same as the write set +*/ +static inline void dbug_tmp_use_all_columns(TABLE *table, + my_bitmap_map **save, + MY_BITMAP *read_set, + MY_BITMAP *write_set) +{ +#ifndef DBUG_OFF + save[0]= read_set->bitmap; + save[1]= write_set->bitmap; + (void) tmp_use_all_columns(table, read_set); + (void) tmp_use_all_columns(table, write_set); +#endif +} + + +static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set, + MY_BITMAP *write_set, + my_bitmap_map **old) +{ +#ifndef DBUG_OFF + tmp_restore_column_map(read_set, old[0]); + tmp_restore_column_map(write_set, old[1]); +#endif +} + + size_t max_row_length(TABLE *table, const uchar *data); -- cgit v1.2.1 From 979974c53ba88f66c2c00b803159599b6856ab21 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Tue, 9 Dec 2008 20:35:02 +0200 Subject: backported the fix for bug #34773 to 5.0 --- mysql-test/r/explain.result | 48 +++++++++++++++++++++++++++++++++++++++++++++ mysql-test/t/explain.test | 29 +++++++++++++++++++++++++++ sql/item.cc | 4 ++-- sql/item_sum.cc | 37 +++++++++++++++++++++++++++++++--- sql/item_sum.h | 25 ++++++++++++++++------- sql/opt_range.cc | 2 +- sql/opt_sum.cc | 6 +++--- sql/sql_select.cc | 16 +++++++-------- 8 files changed, 143 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result index a4c8432d2a4..3aa189f4a9d 100644 --- a/mysql-test/r/explain.result +++ b/mysql-test/r/explain.result @@ -107,3 +107,51 @@ X X X X X X X X X X X X X X X X X X Range checked for each record (index map: 0xFFFFFFFFFF) DROP TABLE t2; DROP TABLE t1; +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1),(2); +EXPLAIN EXTENDED SELECT 1 +FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 DERIVED t2 ALL NULL NULL NULL NULL 2 +Warnings: +Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` +EXPLAIN EXTENDED SELECT 1 +FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 DERIVED t2 ALL NULL NULL NULL NULL 2 +Warnings: +Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` +prepare s1 from +'EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; +execute s1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 DERIVED t2 ALL NULL NULL NULL NULL 2 +Warnings: +Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` +prepare s1 from +'EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; +execute s1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 DERIVED t2 ALL NULL NULL NULL NULL 2 +Warnings: +Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` +execute s1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +2 DERIVED t2 ALL NULL NULL NULL NULL 2 +Warnings: +Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` +DROP TABLE t1,t2; diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index c9ae8aceaf6..0247aca82df 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -94,4 +94,33 @@ EXPLAIN SELECT 1 FROM DROP TABLE t2; DROP TABLE t1; +# +# Bug #34773: query with explain extended and derived table / other table +# crashes server +# + +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1),(2); + +EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; + +EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; + +prepare s1 from +'EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; +execute s1; + +prepare s1 from +'EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; +execute s1; +execute s1; + +DROP TABLE t1,t2; + # End of 5.0 tests. diff --git a/sql/item.cc b/sql/item.cc index 243c22bb7e6..2a89c86cd88 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6795,7 +6795,7 @@ enum_field_types Item_type_holder::get_real_type(Item *item) */ Item_sum *item_sum= (Item_sum *) item; if (item_sum->keep_field_type()) - return get_real_type(item_sum->args[0]); + return get_real_type(item_sum->get_arg(0)); break; } case FUNC_ITEM: @@ -7059,7 +7059,7 @@ void Item_type_holder::get_full_info(Item *item) if (item->type() == Item::SUM_FUNC_ITEM && (((Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC || ((Item_sum*)item)->sum_func() == Item_sum::MIN_FUNC)) - item = ((Item_sum*)item)->args[0]; + item = ((Item_sum*)item)->get_arg(0); /* We can have enum/set type after merging only if we have one enum|set field (or MIN|MAX(enum|set field)) and number of NULL fields diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 91320d6b56b..d33d92a5238 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -370,6 +370,10 @@ Item_sum::Item_sum(List &list) :arg_count(list.elements), args[i++]= item; } } + if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count))) + { + args= NULL; + } mark_as_sum_func(); list.empty(); // Fields are used } @@ -380,18 +384,28 @@ Item_sum::Item_sum(List &list) :arg_count(list.elements), */ Item_sum::Item_sum(THD *thd, Item_sum *item): - Item_result_field(thd, item), arg_count(item->arg_count), + Item_result_field(thd, item), aggr_sel(item->aggr_sel), nest_level(item->nest_level), aggr_level(item->aggr_level), - quick_group(item->quick_group), used_tables_cache(item->used_tables_cache), + quick_group(item->quick_group), + arg_count(item->arg_count), orig_args(NULL), + used_tables_cache(item->used_tables_cache), forced_const(item->forced_const) { if (arg_count <= 2) + { args=tmp_args; + orig_args=tmp_orig_args; + } else + { if (!(args= (Item**) thd->alloc(sizeof(Item*)*arg_count))) return; + if (!(orig_args= (Item**) thd->alloc(sizeof(Item*)*arg_count))) + return; + } memcpy(args, item->args, sizeof(Item*)*arg_count); + memcpy(orig_args, item->orig_args, sizeof(Item*)*arg_count); } @@ -426,12 +440,13 @@ void Item_sum::make_field(Send_field *tmp_field) void Item_sum::print(String *str) { + Item **pargs= orig_args; str->append(func_name()); for (uint i=0 ; i < arg_count ; i++) { if (i) str->append(','); - args[i]->print(str); + pargs[i]->print(str); } str->append(')'); } @@ -532,6 +547,13 @@ void Item_sum::update_used_tables () } +Item *Item_sum::set_arg(int i, THD *thd, Item *new_val) +{ + thd->change_item_tree(args + i, new_val); + return new_val; +} + + String * Item_sum_num::val_str(String *str) { @@ -583,6 +605,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref) if (check_sum_func(thd, ref)) return TRUE; + memcpy (orig_args, args, sizeof (Item *) * arg_count); fixed= 1; return FALSE; } @@ -670,6 +693,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) if (check_sum_func(thd, ref)) return TRUE; + orig_args[0]= args[0]; fixed= 1; return FALSE; } @@ -3107,6 +3131,12 @@ Item_func_group_concat(Name_resolution_context *context_arg, sizeof(ORDER*)*arg_count_order))) return; + if (!(orig_args= (Item **) sql_alloc(sizeof(Item *) * arg_count))) + { + args= NULL; + return; + } + order= (ORDER**)(args + arg_count); /* fill args items of show and sort */ @@ -3334,6 +3364,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) if (check_sum_func(thd, ref)) return TRUE; + memcpy (orig_args, args, sizeof (Item *) * arg_count); fixed= 1; return FALSE; } diff --git a/sql/item_sum.h b/sql/item_sum.h index d39fc96e254..51a1eff9bbf 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -228,10 +228,8 @@ public: VARIANCE_FUNC, SUM_BIT_FUNC, UDF_SUM_FUNC, GROUP_CONCAT_FUNC }; - Item **args, *tmp_args[2]; Item **ref_by; /* pointer to a ref to the object used to register it */ Item_sum *next; /* next in the circular chain of registered objects */ - uint arg_count; Item_sum *in_sum_func; /* embedding set function if any */ st_select_lex * aggr_sel; /* select where the function is aggregated */ int8 nest_level; /* number of the nesting level of the set function */ @@ -248,24 +246,32 @@ public: List outer_fields; protected: + uint arg_count; + Item **args, *tmp_args[2]; + /* + Copy of the arguments list to hold the original set of arguments. + Used in EXPLAIN EXTENDED instead of the current argument list because + the current argument list can be altered by usage of temporary tables. + */ + Item **orig_args, *tmp_orig_args[2]; table_map used_tables_cache; bool forced_const; public: void mark_as_sum_func(); - Item_sum() :arg_count(0), quick_group(1), forced_const(FALSE) + Item_sum() :quick_group(1), arg_count(0), forced_const(FALSE) { mark_as_sum_func(); } - Item_sum(Item *a) :args(tmp_args), arg_count(1), quick_group(1), - forced_const(FALSE) + Item_sum(Item *a) :quick_group(1), arg_count(1), args(tmp_args), + orig_args(tmp_orig_args), forced_const(FALSE) { args[0]=a; mark_as_sum_func(); } - Item_sum( Item *a, Item *b ) :args(tmp_args), arg_count(2), quick_group(1), - forced_const(FALSE) + Item_sum( Item *a, Item *b ) :quick_group(1), arg_count(2), args(tmp_args), + orig_args(tmp_orig_args), forced_const(FALSE) { args[0]=a; args[1]=b; mark_as_sum_func(); @@ -374,6 +380,10 @@ public: bool register_sum_func(THD *thd, Item **ref); st_select_lex *depended_from() { return (nest_level == aggr_level ? 0 : aggr_sel); } + + Item *get_arg(int i) { return args[i]; } + Item *set_arg(int i, THD *thd, Item *new_val); + uint get_arg_count() { return arg_count; } }; @@ -981,6 +991,7 @@ public: if (udf.fix_fields(thd, this, this->arg_count, this->args)) return TRUE; + memcpy (orig_args, args, sizeof (Item *) * arg_count); return check_sum_func(thd, ref); } enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 204ebdb6f33..7d9b1179d87 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -7735,7 +7735,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) DBUG_RETURN(NULL); /* The argument of MIN/MAX. */ - Item *expr= min_max_item->args[0]->real_item(); + Item *expr= min_max_item->get_arg(0)->real_item(); if (expr->type() == Item::FIELD_ITEM) /* Is it an attribute? */ { if (! min_max_arg_item) diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 3fc62d05ae5..39db1344588 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -160,7 +160,7 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) to the number of rows in the tables if this number is exact and there are no outer joins. */ - if (!conds && !((Item_sum_count*) item)->args[0]->maybe_null && + if (!conds && !((Item_sum_count*) item)->get_arg(0)->maybe_null && !outer_tables && is_exact_count) { ((Item_sum_count*) item)->make_const(count); @@ -176,7 +176,7 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) parts of the key is found in the COND, then we can use indexes to find the key. */ - Item *expr=item_sum->args[0]; + Item *expr=item_sum->get_arg(0); if (expr->real_item()->type() == Item::FIELD_ITEM) { byte key_buff[MAX_KEY_LENGTH]; @@ -319,7 +319,7 @@ int opt_sum_query(TABLE_LIST *tables, List &all_fields,COND *conds) parts of the key is found in the COND, then we can use indexes to find the key. */ - Item *expr=item_sum->args[0]; + Item *expr=item_sum->get_arg(0); if (expr->real_item()->type() == Item::FIELD_ITEM) { byte key_buff[MAX_KEY_LENGTH]; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b080fff8725..48276170caf 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9444,11 +9444,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, } if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields) { /* Can't calc group yet */ - ((Item_sum*) item)->result_field=0; - for (i=0 ; i < ((Item_sum*) item)->arg_count ; i++) + Item_sum *sum_item= (Item_sum *) item; + sum_item->result_field=0; + for (i=0 ; i < sum_item->get_arg_count() ; i++) { - Item **argp= ((Item_sum*) item)->args + i; - Item *arg= *argp; + Item *arg= sum_item->get_arg(i); if (!arg->const_item()) { uint field_index= (uint) (reg_field - table->field); @@ -9478,7 +9478,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, string_total_length+= new_field->pack_length(); } thd->mem_root= mem_root_save; - thd->change_item_tree(argp, new Item_field(new_field)); + arg= sum_item->set_arg(i, thd, new Item_field(new_field)); thd->mem_root= &table->mem_root; if (!(new_field->flags & NOT_NULL_FLAG)) { @@ -9487,7 +9487,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, new_field->maybe_null() is still false, it will be changed below. But we have to setup Item_field correctly */ - (*argp)->maybe_null=1; + arg->maybe_null=1; } new_field->query_id= thd->query_id; } @@ -13922,9 +13922,9 @@ count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param, param->quick_group=0; // UDF SUM function param->sum_func_count++; - for (uint i=0 ; i < sum_item->arg_count ; i++) + for (uint i=0 ; i < sum_item->get_arg_count() ; i++) { - if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM) + if (sum_item->get_arg(i)->real_item()->type() == Item::FIELD_ITEM) param->field_count++; else param->func_count++; -- cgit v1.2.1 From 8d4b41605b0bbc731dafc7bd8a9f850eaf06f552 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 10 Dec 2008 13:05:57 +0400 Subject: Bug#38227 EXTRACTVALUE doesn't work with DTD declarations Problem: XML syntax parser allowed to use quoted strings as attribute names, and tried to put them into parser state stack instead of identifiers. After that parser failed, if quoted string contained some slash characters. Fix: - Disallowing quoted strings in regular tags. - Allowing quoted string in DOCTYPE declararion, but don't push it into parse state stack (just skip it). --- mysql-test/r/xml.result | 24 ++++++++++++++++++++++++ mysql-test/t/xml.test | 25 +++++++++++++++++++++++++ strings/xml.c | 13 +++++++++++-- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 56c884343e3..41c0d6bee21 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1029,4 +1029,28 @@ SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1')); 1 1 DROP TABLE t1; +SET @xml= +' + + + Title - document with document declaration + + Hi, Im a webpage with document a declaration +'; +SELECT ExtractValue(@xml, 'html/head/title'); +ExtractValue(@xml, 'html/head/title') + Title - document with document declaration +SELECT ExtractValue(@xml, 'html/body'); +ExtractValue(@xml, 'html/body') + Hi, Im a webpage with document a declaration +SELECT ExtractValue('CharData', '/xml'); +ExtractValue('CharData', '/xml') +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 11: STRING unexpected ('>' wanted)' +SELECT ExtractValue('CharData', '/xml'); +ExtractValue('CharData', '/xml') +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 17: STRING unexpected ('>' wanted)' End of 5.1 tests diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 5ca9c7afd76..d840e14ba5f 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -551,4 +551,29 @@ INSERT INTO t1 VALUES (0), (0); SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1')); DROP TABLE t1; +# +# BUG#38227 EXTRACTVALUE doesn't work with DTD declarations +# +# Check that quoted strings work fine in DOCTYPE declaration. +# + +SET @xml= +' + + + Title - document with document declaration + + Hi, Im a webpage with document a declaration +'; + +SELECT ExtractValue(@xml, 'html/head/title'); +SELECT ExtractValue(@xml, 'html/body'); + +# These two documents will fail. +# Quoted strings are not allowed in regular tags +# +SELECT ExtractValue('CharData', '/xml'); +SELECT ExtractValue('CharData', '/xml'); + + --echo End of 5.1 tests diff --git a/strings/xml.c b/strings/xml.c index 5c62a8e8603..1b697ec6b26 100644 --- a/strings/xml.c +++ b/strings/xml.c @@ -328,7 +328,7 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len) } while ((MY_XML_IDENT == (lex=my_xml_scan(p,&a))) || - (MY_XML_STRING == lex)) + ((MY_XML_STRING == lex && exclam))) { MY_XML_ATTR b; if (MY_XML_EQ == (lex=my_xml_scan(p,&b))) @@ -349,13 +349,22 @@ int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len) return MY_XML_ERROR; } } - else if ((MY_XML_STRING == lex) || (MY_XML_IDENT == lex)) + else if (MY_XML_IDENT == lex) { p->current_node_type= MY_XML_NODE_ATTR; if ((MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) || (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))) return MY_XML_ERROR; } + else if ((MY_XML_STRING == lex) && exclam) + { + /* + We are in , e.g. + + + Just skip "SystemLiteral" and "PublicidLiteral" + */ + } else break; } -- cgit v1.2.1 From 3f2f3d84de0700a2651b1a7ff33b45016b97ff0e Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Wed, 10 Dec 2008 16:07:32 +0300 Subject: Fix for a test failure on Solaris/x86/gcc introduced by the patch for bug #27483. Removed values with more than 15 significant digits from the test case. Results of reading/printing such values using system library functions depend on implementation and thus are not portable. mysql-test/r/type_float.result: Removed values with more than 15 significant digits from the test case. mysql-test/t/type_float.test: Removed values with more than 15 significant digits from the test case. --- mysql-test/r/type_float.result | 6 +----- mysql-test/t/type_float.test | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index d86c515062a..8caabbff047 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -393,15 +393,11 @@ f1 + 0e0 -1.0000000150475e+30 drop table t1; create table t1(d double, u bigint unsigned); -insert into t1(d) values (9.2233720368547777e+18), -(9.223372036854779e18), -(9.22337203685479e18), +insert into t1(d) values (9.22337203685479e18), (1.84e19); update t1 set u = d; select u from t1; u -9223372036854775808 -9223372036854779904 9223372036854790144 18400000000000000000 drop table t1; diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 3ceef129912..53bcf44061d 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -259,9 +259,7 @@ drop table t1; create table t1(d double, u bigint unsigned); -insert into t1(d) values (9.2233720368547777e+18), - (9.223372036854779e18), - (9.22337203685479e18), +insert into t1(d) values (9.22337203685479e18), (1.84e19); update t1 set u = d; -- cgit v1.2.1 From 84de3b930bcae8af7a7b5613dd8be514afbb8661 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 10 Dec 2008 18:13:11 +0400 Subject: Bug#37956 memory leak and / or crash with geometry and prepared statements! Bug#37671 crash on prepared statement + cursor + geometry + too many open files! if mysql_execute_command() returns error then free materialized_cursor object. is_rnd_inited is added to satisfy rnd_end() assertion (handler may be uninitialized in some cases) sql/sql_cursor.cc: if mysql_execute_command() returns error then free materialized_cursor object. is_rnd_inited is added to satisfy rnd_end() assertion (handler may be uninitialized in some cases) sql/sql_select.cc: added result check tests/mysql_client_test.c: test case --- sql/sql_cursor.cc | 18 +++++++++++----- sql/sql_select.cc | 7 ++++-- tests/mysql_client_test.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 7 deletions(-) diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 16567765ba6..83c60814cf3 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -85,6 +85,7 @@ class Materialized_cursor: public Server_side_cursor List item_list; ulong fetch_limit; ulong fetch_count; + bool is_rnd_inited; public: Materialized_cursor(select_result *result, TABLE *table); @@ -191,7 +192,11 @@ int mysql_open_cursor(THD *thd, uint flags, select_result *result, such command is SHOW VARIABLES or SHOW STATUS. */ if (rc) + { + if (result_materialize->materialized_cursor) + delete result_materialize->materialized_cursor; goto err_open; + } if (sensitive_cursor->is_open()) { @@ -532,7 +537,8 @@ Materialized_cursor::Materialized_cursor(select_result *result_arg, :Server_side_cursor(&table_arg->mem_root, result_arg), table(table_arg), fetch_limit(0), - fetch_count(0) + fetch_count(0), + is_rnd_inited(0) { fake_unit.init_query(); fake_unit.thd= table->in_use; @@ -589,11 +595,12 @@ int Materialized_cursor::open(JOIN *join __attribute__((unused))) THD *thd= fake_unit.thd; int rc; Query_arena backup_arena; - thd->set_n_backup_active_arena(this, &backup_arena); /* Create a list of fields and start sequential scan */ - rc= (result->prepare(item_list, &fake_unit) || - table->file->ha_rnd_init(TRUE)); + rc= result->prepare(item_list, &fake_unit); + if (!rc && !(rc= table->file->ha_rnd_init(TRUE))) + is_rnd_inited= 1; + thd->restore_active_arena(this, &backup_arena); if (rc == 0) { @@ -673,7 +680,8 @@ void Materialized_cursor::close() { /* Free item_list items */ free_items(); - (void) table->file->ha_rnd_end(); + if (is_rnd_inited) + (void) table->file->ha_rnd_end(); /* We need to grab table->mem_root to prevent free_tmp_table from freeing: the cursor object was allocated in this memory. diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 48276170caf..d2c469f99da 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1599,8 +1599,11 @@ JOIN::exec() (zero_result_cause?zero_result_cause:"No tables used")); else { - result->send_fields(*columns_list, - Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF); + if (result->send_fields(*columns_list, + Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) + { + DBUG_VOID_RETURN; + } /* We have to test for 'conds' here as the WHERE may not be constant even if we don't have any tables for prepared statements or if diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index ee3a053f8bd..ea4d363bdac 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -15899,6 +15899,59 @@ static void test_bug28934() } +/** + Bug#37956 memory leak and / or crash with geometry and prepared statements! +*/ + +static void test_bug37956(void) +{ + const char *query="select point(?,?)"; + MYSQL_STMT *stmt=NULL; + unsigned int val=0; + MYSQL_BIND bind_param[2]; + unsigned char buff[2]= { 134, 211 }; + DBUG_ENTER("test_bug37956"); + myheader("test_bug37956"); + + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + + val=1; + mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void *)&val); + val=CURSOR_TYPE_READ_ONLY; + mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void *)&val); + val=0; + mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS, (void *)&val); + + memset(bind_param, 0, sizeof(bind_param)); + bind_param[0].buffer_type=MYSQL_TYPE_TINY; + bind_param[0].buffer= (void *)buff; + bind_param[0].is_null=NULL; + bind_param[0].error=NULL; + bind_param[0].is_unsigned=1; + bind_param[1].buffer_type=MYSQL_TYPE_TINY; + bind_param[1].buffer= (void *)(buff+1); + bind_param[1].is_null=NULL; + bind_param[1].error=NULL; + bind_param[1].is_unsigned=1; + + if (mysql_stmt_bind_param(stmt, bind_param)) + { + mysql_stmt_close(stmt); + DIE_UNLESS(0); + } + + if (mysql_stmt_execute(stmt)) + { + mysql_stmt_close(stmt); + DBUG_VOID_RETURN; + } + /* Should never reach here: execution returns an error. */ + mysql_stmt_close(stmt); + DIE_UNLESS(0); + DBUG_VOID_RETURN; +} + /* Bug#27592 (stack overrun when storing datetime value using prepared statements) */ @@ -16595,6 +16648,7 @@ static struct my_tests_st my_tests[]= { { "test_bug32265", test_bug32265 }, { "test_bug38486", test_bug38486 }, { "test_bug40365", test_bug40365 }, + { "test_bug37956", test_bug37956 }, { 0, 0 } }; -- cgit v1.2.1 From 52fffecb5b6a6794c56cb75289b9c2b5f97d8bf1 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 10 Dec 2008 18:38:27 +0400 Subject: Bug#35275 INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS omits KEY_BLOCK_SIZE Added KEY_BLOCK_SIZE option to I_S.TABLES.CREATE_OPTIONS field mysql-test/r/information_schema.result: test result mysql-test/t/information_schema.test: test case sql/sql_show.cc: Added KEY_BLOCK_SIZE option to I_S.TABLES.CREATE_OPTIONS field --- mysql-test/r/information_schema.result | 5 +++++ mysql-test/t/information_schema.test | 7 +++++++ sql/sql_show.cc | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 85af461eb14..4fd0bdde063 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1707,4 +1707,9 @@ where a.VARIABLE_NAME = b.VARIABLE_NAME; a.VARIABLE_VALUE - b.VARIABLE_VALUE 2 drop table t0; +CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1; +SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +CREATE_OPTIONS +KEY_BLOCK_SIZE=1 +DROP TABLE t1; End of 5.1 tests. diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index bcb22c44076..3dbdf76c220 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1383,4 +1383,11 @@ select a.VARIABLE_VALUE - b.VARIABLE_VALUE from t0 b, information_schema.global_ where a.VARIABLE_NAME = b.VARIABLE_NAME; drop table t0; +# +# Bug#35275 INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS omits KEY_BLOCK_SIZE +# +CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1; +SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +DROP TABLE t1; + --echo End of 5.1 tests. diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a506429fb97..3fd06aba672 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3589,6 +3589,11 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, (share->transactional == HA_CHOICE_YES ? "1" : "0"), NullS); } + if (share->key_block_size) + { + ptr= strmov(ptr, " KEY_BLOCK_SIZE="); + ptr= longlong10_to_str(share->key_block_size, ptr, 10); + } #ifdef WITH_PARTITION_STORAGE_ENGINE if (is_partitioned) ptr= strmov(ptr, " partitioned"); -- cgit v1.2.1 From 207d519a080e6df0d2ec57a1abc784f2043f366c Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Wed, 10 Dec 2008 19:29:22 +0100 Subject: post push fix for test case for bug#39084. mysql-test/t/partition_innodb_stmt.test: post push fix for test case for bug#39084. (must have partitioning...) --- mysql-test/t/partition_innodb_stmt.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/partition_innodb_stmt.test b/mysql-test/t/partition_innodb_stmt.test index 2ed5baee0ac..d6181ce068e 100644 --- a/mysql-test/t/partition_innodb_stmt.test +++ b/mysql-test/t/partition_innodb_stmt.test @@ -1,3 +1,4 @@ +--source include/have_partition.inc --source include/have_binlog_format_statement.inc --source include/have_innodb.inc -- cgit v1.2.1 From 7f5d980af70c2d7c8ba88a3ef8bef45fca4e635b Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 11 Dec 2008 12:57:59 +0400 Subject: disable bug37956 test if geometry package is not enabled --- tests/mysql_client_test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index ea4d363bdac..79d188c252c 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -15899,6 +15899,7 @@ static void test_bug28934() } +#ifdef HAVE_SPATIAL /** Bug#37956 memory leak and / or crash with geometry and prepared statements! */ @@ -15951,6 +15952,7 @@ static void test_bug37956(void) DIE_UNLESS(0); DBUG_VOID_RETURN; } +#endif /* Bug#27592 (stack overrun when storing datetime value using prepared statements) @@ -16648,7 +16650,9 @@ static struct my_tests_st my_tests[]= { { "test_bug32265", test_bug32265 }, { "test_bug38486", test_bug38486 }, { "test_bug40365", test_bug40365 }, +#ifdef HAVE_SPATIAL { "test_bug37956", test_bug37956 }, +#endif { 0, 0 } }; -- cgit v1.2.1 From d2cd545b53397f36572001def335cf75c86570cf Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 11 Dec 2008 14:37:18 +0400 Subject: fix for pushbuild failure on 64 linux --- tests/mysql_client_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 79d188c252c..50f03a1a086 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -15908,7 +15908,7 @@ static void test_bug37956(void) { const char *query="select point(?,?)"; MYSQL_STMT *stmt=NULL; - unsigned int val=0; + ulong val=0; MYSQL_BIND bind_param[2]; unsigned char buff[2]= { 134, 211 }; DBUG_ENTER("test_bug37956"); -- cgit v1.2.1 From ac27e637badd31ee2dca9a7852fbb5ec0a5c11d0 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 11 Dec 2008 11:06:50 +0000 Subject: Fix PB warnings for parenthesis and valgrind leak report. BUG#38826 --- sql/log.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 477cb21b2f3..c411f7c8238 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1146,7 +1146,7 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli, bool included) * Need to update the log pos because purge logs has been called * after fetching initially the log pos at the begining of the method. */ - if(error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0)) + if((error=find_log_pos(&rli->linfo, rli->event_relay_log_name, 0))) { char buff[22]; sql_print_error("next log error: %d offset: %s log: %s included: %d", @@ -1234,8 +1234,8 @@ int MYSQL_LOG::purge_logs(const char *to_log, */ if (!my_b_inited(&purge_temp)) { - if (error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX, - DISK_BUFFER_SIZE, MYF(MY_WME))) + if ((error=open_cached_file(&purge_temp, mysql_tmpdir, TEMP_PREFIX, + DISK_BUFFER_SIZE, MYF(MY_WME)))) { sql_print_error("MYSQL_LOG::purge_logs failed to open purge_temp"); goto err; @@ -1243,7 +1243,7 @@ int MYSQL_LOG::purge_logs(const char *to_log, } else { - if (error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1)) + if ((error=reinit_io_cache(&purge_temp, WRITE_CACHE, 0, 0, 1))) { sql_print_error("MYSQL_LOG::purge_logs failed to reinit purge_temp " "for write"); @@ -1274,7 +1274,7 @@ int MYSQL_LOG::purge_logs(const char *to_log, } /* We know how many files to delete. Update index file. */ - if (error=update_log_index(&log_info, need_update_threads)) + if ((error=update_log_index(&log_info, need_update_threads))) { sql_print_error("MSYQL_LOG::purge_logs failed to update the index file"); goto err; @@ -1283,7 +1283,7 @@ int MYSQL_LOG::purge_logs(const char *to_log, DBUG_EXECUTE_IF("crash_after_update_index", abort();); /* Switch purge_temp for read. */ - if (error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0)) + if ((error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0))) { sql_print_error("MSYQL_LOG::purge_logs failed to reinit purge_temp " "for read"); @@ -1409,6 +1409,7 @@ int MYSQL_LOG::purge_logs(const char *to_log, } err: + close_cached_file(&purge_temp); if (need_mutex) pthread_mutex_unlock(&LOCK_index); DBUG_RETURN(error); -- cgit v1.2.1 From d84690c92d165e0335da16a7e95b10ac5684420e Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Thu, 11 Dec 2008 12:26:03 -0500 Subject: Bug#33812: mysql client incorrectly parsing DELIMITER Fix parsing of mysql client commands, especially in relation to single-line comments when --comments was specified. This is a little tricky, because we need to allow single-line comments in the middle of statements, but we don't want to allow client commands in the middle of statements. So in comment-preservation mode, we go ahead and send single-line comments to the server immediately when we encounter them on their own. This is still slightly flawed, in that it does not handle a single-line comment with leading spaces, followed by a client-side command when --comment has been enabled. But this isn't a new problem, and it is quite an edge condition. Fixing it would require a more extensive overall of how the mysql client parses commands. --- client/mysql.cc | 49 ++++++++++++++++------------------------------- mysql-test/r/mysql.result | 6 ++++++ mysql-test/t/mysql.test | 19 ++++++++++++++++++ 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 9b14f9fb3ef..20f87d5cdcd 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1998,7 +1998,7 @@ static bool add_line(String &buffer,char *line,char *in_string, { if (!preserve_comments) { - // Skip spaces at the beggining of a statement + // Skip spaces at the beginning of a statement if (my_isspace(charset_info,inchar) && (out == line) && buffer.is_empty()) continue; @@ -2081,37 +2081,6 @@ static bool add_line(String &buffer,char *line,char *in_string, continue; } } - else if (!*ml_comment && !*in_string && - (end_of_line - pos) >= 10 && - !my_strnncoll(charset_info, (uchar*) pos, 10, - (const uchar*) "delimiter ", 10)) - { - // Flush previously accepted characters - if (out != line) - { - buffer.append(line, (uint32) (out - line)); - out= line; - } - - // Flush possible comments in the buffer - if (!buffer.is_empty()) - { - if (com_go(&buffer, 0) > 0) // < 0 is not fatal - DBUG_RETURN(1); - buffer.length(0); - } - - /* - Delimiter wants the get rest of the given line as argument to - allow one to change ';' to ';;' and back - */ - buffer.append(pos); - if (com_delimiter(&buffer, pos) > 0) - DBUG_RETURN(1); - - buffer.length(0); - break; - } else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter)) { // Found a statement. Continue parsing after the delimiter @@ -2174,8 +2143,24 @@ static bool add_line(String &buffer,char *line,char *in_string, // comment to end of line if (preserve_comments) + { + bool started_with_nothing= !buffer.length(); + buffer.append(pos); + /* + A single-line comment by itself gets sent immediately so that + client commands (delimiter, status, etc) will be interpreted on + the next line. + */ + if (started_with_nothing) + { + if (com_go(&buffer, 0) > 0) // < 0 is not fatal + DBUG_RETURN(1); + buffer.length(0); + } + } + break; } else if (!*in_string && inchar == '/' && *(pos+1) == '*' && diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index eded1a3fc3b..95bdcab6ba1 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -180,4 +180,10 @@ ERROR at line 1: DELIMITER cannot contain a backslash character 1 This is a file starting with UTF8 BOM 0xEFBBBF This is a file starting with UTF8 BOM 0xEFBBBF +delimiter +1 +2 +2 +2 +2 End of 5.0 tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 182b292c817..76941af893a 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -290,4 +290,23 @@ EOF --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql; +# +# Bug #33812: mysql client incorrectly parsing DELIMITER +# +# The space and ; after delimiter are important +--exec $MYSQL -e "select 1 delimiter ;" + +# +# Bug #38158: mysql client regression, can't read dump files +# +--write_file $MYSQLTEST_VARDIR/tmp/bug38158.sql +-- Testing +-- +delimiter || +select 2 || +EOF +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1 +--exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql; + --echo End of 5.0 tests -- cgit v1.2.1 From ffe23f0eb736609915d3c201c3f2556819698dc1 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Fri, 12 Dec 2008 00:57:32 +0400 Subject: Bug #40761: Assert on sum function on IF(..., CAST(longtext AS UNSIGNED), signed_val) (was: LEFT JOIN on inline view crashes server) Select from a LONGTEXT column wrapped with an expression like "IF(..., CAST(longtext_column AS UNSIGNED), smth_signed)" failed an assertion or crashed the server. IFNULL function was affected too. LONGTEXT column item has a maximum length of 32^2-1 bytes, at the same time this is a maximum possible length of any MySQL item. CAST(longtext_column AS UNSIGNED) returns some unsigned numeric result of length 32^2-1, so the result of IF/IFNULL function of this number and some other signed number will have text length of (32^2-1)+1=32^2 (one byte for the minus sign) - there is integer overflow, and the length is equal to zero. That caused assert/crash. The bug has been fixed by the same solution as in the CASE function implementation. mysql-test/r/func_if.result: Added test case for bug #40761. mysql-test/t/func_if.test: Added test case for bug #40761. sql/item_cmpfunc.cc: Bug #40761: Assert on sum function on IF(..., CAST(longtext AS UNSIGNED), signed_val) 1. Item_func_case::agg_str_lengths method has been moved to the Item_func superclass. 2. Item_func_ifnull/Item_func_if::fix_length_and_dec methods have been updated to calculate max_length, decimals and unsigned flag like Item_func_case. sql/item_cmpfunc.h: Bug #40761: Assert on sum function on IF(..., CAST(longtext AS UNSIGNED), signed_val) Item_func_case::agg_str_lengths method has been moved to the Item_func superclass. sql/item_func.cc: Bug #40761: Assert on sum function on IF(..., CAST(longtext AS UNSIGNED), signed_val) Item_func_case::agg_str_lengths method has been moved to the Item_func superclass. sql/item_func.h: Bug #40761: Assert on sum function on IF(..., CAST(longtext AS UNSIGNED), signed_val) Item_func_case::agg_str_lengths method has been moved to the Item_func superclass. --- mysql-test/r/func_if.result | 9 ++++++++ mysql-test/t/func_if.test | 13 ++++++++++++ sql/item_cmpfunc.cc | 50 ++++++++++++++++++++------------------------- sql/item_cmpfunc.h | 1 - sql/item_func.cc | 10 +++++++++ sql/item_func.h | 2 ++ 6 files changed, 56 insertions(+), 29 deletions(-) diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 7ffc957e285..16d6b435dc7 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -176,4 +176,13 @@ IF((ROUND(t1.a,2)=1), 2, IF((ROUND(t1.a,2)=1), 2, IF((R DROP TABLE t1; +CREATE TABLE t1 (c LONGTEXT); +INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890'); +SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +MAX(IF(1, CAST(c AS UNSIGNED), 0)) +12345678901234567890 +SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +MAX(IFNULL(CAST(c AS UNSIGNED), 0)) +12345678901234567890 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 8da10f36cbe..68728d6697e 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -150,4 +150,17 @@ FROM t1; DROP TABLE t1; +# +# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed) +# (was: LEFT JOIN on inline view crashes server) +# + +CREATE TABLE t1 (c LONGTEXT); +INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890'); + +SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te; + +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 3b1d18b4252..759e912cc82 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2069,21 +2069,23 @@ Item_func_ifnull::fix_length_and_dec() { agg_result_type(&hybrid_type, args, 2); maybe_null=args[1]->maybe_null; - decimals= max(args[0]->decimals, args[1]->decimals); - unsigned_flag= args[0]->unsigned_flag && args[1]->unsigned_flag; if (hybrid_type == DECIMAL_RESULT || hybrid_type == INT_RESULT) { - int len0= args[0]->max_length - args[0]->decimals - - (args[0]->unsigned_flag ? 0 : 1); - - int len1= args[1]->max_length - args[1]->decimals - - (args[1]->unsigned_flag ? 0 : 1); - - max_length= max(len0, len1) + decimals + (unsigned_flag ? 0 : 1); + max_length= 0; + decimals= 0; + unsigned_flag= TRUE; + agg_num_lengths(args[0]); + agg_num_lengths(args[1]); + max_length= my_decimal_precision_to_length(max_length + decimals, decimals, + unsigned_flag); } else + { max_length= max(args[0]->max_length, args[1]->max_length); + decimals= max(args[0]->decimals, args[1]->decimals); + unsigned_flag=args[0]->unsigned_flag && args[1]->unsigned_flag; + } switch (hybrid_type) { case STRING_RESULT: @@ -2238,8 +2240,6 @@ void Item_func_if::fix_length_and_dec() { maybe_null=args[1]->maybe_null || args[2]->maybe_null; - decimals= max(args[1]->decimals, args[2]->decimals); - unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag; enum Item_result arg1_type=args[1]->result_type(); enum Item_result arg2_type=args[2]->result_type(); @@ -2276,16 +2276,20 @@ Item_func_if::fix_length_and_dec() if ((cached_result_type == DECIMAL_RESULT ) || (cached_result_type == INT_RESULT)) { - int len1= args[1]->max_length - args[1]->decimals - - (args[1]->unsigned_flag ? 0 : 1); - - int len2= args[2]->max_length - args[2]->decimals - - (args[2]->unsigned_flag ? 0 : 1); - - max_length=max(len1, len2) + decimals + (unsigned_flag ? 0 : 1); + max_length= 0; + decimals= 0; + unsigned_flag= TRUE; + agg_num_lengths(args[1]); + agg_num_lengths(args[2]); + max_length= my_decimal_precision_to_length(max_length + decimals, decimals, + unsigned_flag); } else + { max_length= max(args[1]->max_length, args[2]->max_length); + decimals= max(args[1]->decimals, args[2]->decimals); + unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag; + } } @@ -2633,16 +2637,6 @@ void Item_func_case::agg_str_lengths(Item* arg) } -void Item_func_case::agg_num_lengths(Item *arg) -{ - uint len= my_decimal_length_to_precision(arg->max_length, arg->decimals, - arg->unsigned_flag) - arg->decimals; - set_if_bigger(max_length, len); - set_if_bigger(decimals, arg->decimals); - unsigned_flag= unsigned_flag && arg->unsigned_flag; -} - - void Item_func_case::fix_length_and_dec() { Item **agg; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index db831c7030c..6ecbfba140f 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -759,7 +759,6 @@ public: Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } void agg_str_lengths(Item *arg); - void agg_num_lengths(Item *arg); }; diff --git a/sql/item_func.cc b/sql/item_func.cc index c0d08d9b213..c650b0ae933 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5668,3 +5668,13 @@ void Item_func_sp::update_used_tables() const_item_cache= FALSE; } } + + +void Item_func::agg_num_lengths(Item *arg) +{ + uint len= my_decimal_length_to_precision(arg->max_length, arg->decimals, + arg->unsigned_flag) - arg->decimals; + set_if_bigger(max_length, len); + set_if_bigger(decimals, arg->decimals); + unsigned_flag= unsigned_flag && arg->unsigned_flag; +} diff --git a/sql/item_func.h b/sql/item_func.h index 6dcf32cba07..d4da0b7a853 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -193,6 +193,8 @@ public: void * arg, traverse_order order); bool is_expensive_processor(byte *arg); virtual bool is_expensive() { return 0; } +protected: + void agg_num_lengths(Item *arg); }; -- cgit v1.2.1 From 5ff1bcbc2a3cf3b28ce11673d89a1d2b3d8ad376 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Fri, 12 Dec 2008 14:59:10 +0400 Subject: rollback of bug #40761 fix --- mysql-test/r/func_if.result | 9 -------- mysql-test/t/func_if.test | 13 ------------ sql/item_cmpfunc.cc | 50 +++++++++++++++++++++++++-------------------- sql/item_cmpfunc.h | 1 + sql/item_func.cc | 10 --------- sql/item_func.h | 2 -- 6 files changed, 29 insertions(+), 56 deletions(-) diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 16d6b435dc7..7ffc957e285 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -176,13 +176,4 @@ IF((ROUND(t1.a,2)=1), 2, IF((ROUND(t1.a,2)=1), 2, IF((R DROP TABLE t1; -CREATE TABLE t1 (c LONGTEXT); -INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890'); -SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te; -MAX(IF(1, CAST(c AS UNSIGNED), 0)) -12345678901234567890 -SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te; -MAX(IFNULL(CAST(c AS UNSIGNED), 0)) -12345678901234567890 -DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 68728d6697e..8da10f36cbe 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -150,17 +150,4 @@ FROM t1; DROP TABLE t1; -# -# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed) -# (was: LEFT JOIN on inline view crashes server) -# - -CREATE TABLE t1 (c LONGTEXT); -INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890'); - -SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te; -SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te; - -DROP TABLE t1; - --echo End of 5.0 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 759e912cc82..3b1d18b4252 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2069,23 +2069,21 @@ Item_func_ifnull::fix_length_and_dec() { agg_result_type(&hybrid_type, args, 2); maybe_null=args[1]->maybe_null; + decimals= max(args[0]->decimals, args[1]->decimals); + unsigned_flag= args[0]->unsigned_flag && args[1]->unsigned_flag; if (hybrid_type == DECIMAL_RESULT || hybrid_type == INT_RESULT) { - max_length= 0; - decimals= 0; - unsigned_flag= TRUE; - agg_num_lengths(args[0]); - agg_num_lengths(args[1]); - max_length= my_decimal_precision_to_length(max_length + decimals, decimals, - unsigned_flag); + int len0= args[0]->max_length - args[0]->decimals + - (args[0]->unsigned_flag ? 0 : 1); + + int len1= args[1]->max_length - args[1]->decimals + - (args[1]->unsigned_flag ? 0 : 1); + + max_length= max(len0, len1) + decimals + (unsigned_flag ? 0 : 1); } else - { max_length= max(args[0]->max_length, args[1]->max_length); - decimals= max(args[0]->decimals, args[1]->decimals); - unsigned_flag=args[0]->unsigned_flag && args[1]->unsigned_flag; - } switch (hybrid_type) { case STRING_RESULT: @@ -2240,6 +2238,8 @@ void Item_func_if::fix_length_and_dec() { maybe_null=args[1]->maybe_null || args[2]->maybe_null; + decimals= max(args[1]->decimals, args[2]->decimals); + unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag; enum Item_result arg1_type=args[1]->result_type(); enum Item_result arg2_type=args[2]->result_type(); @@ -2276,20 +2276,16 @@ Item_func_if::fix_length_and_dec() if ((cached_result_type == DECIMAL_RESULT ) || (cached_result_type == INT_RESULT)) { - max_length= 0; - decimals= 0; - unsigned_flag= TRUE; - agg_num_lengths(args[1]); - agg_num_lengths(args[2]); - max_length= my_decimal_precision_to_length(max_length + decimals, decimals, - unsigned_flag); + int len1= args[1]->max_length - args[1]->decimals + - (args[1]->unsigned_flag ? 0 : 1); + + int len2= args[2]->max_length - args[2]->decimals + - (args[2]->unsigned_flag ? 0 : 1); + + max_length=max(len1, len2) + decimals + (unsigned_flag ? 0 : 1); } else - { max_length= max(args[1]->max_length, args[2]->max_length); - decimals= max(args[1]->decimals, args[2]->decimals); - unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag; - } } @@ -2637,6 +2633,16 @@ void Item_func_case::agg_str_lengths(Item* arg) } +void Item_func_case::agg_num_lengths(Item *arg) +{ + uint len= my_decimal_length_to_precision(arg->max_length, arg->decimals, + arg->unsigned_flag) - arg->decimals; + set_if_bigger(max_length, len); + set_if_bigger(decimals, arg->decimals); + unsigned_flag= unsigned_flag && arg->unsigned_flag; +} + + void Item_func_case::fix_length_and_dec() { Item **agg; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 6ecbfba140f..db831c7030c 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -759,6 +759,7 @@ public: Item *find_item(String *str); CHARSET_INFO *compare_collation() { return cmp_collation.collation; } void agg_str_lengths(Item *arg); + void agg_num_lengths(Item *arg); }; diff --git a/sql/item_func.cc b/sql/item_func.cc index c650b0ae933..c0d08d9b213 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5668,13 +5668,3 @@ void Item_func_sp::update_used_tables() const_item_cache= FALSE; } } - - -void Item_func::agg_num_lengths(Item *arg) -{ - uint len= my_decimal_length_to_precision(arg->max_length, arg->decimals, - arg->unsigned_flag) - arg->decimals; - set_if_bigger(max_length, len); - set_if_bigger(decimals, arg->decimals); - unsigned_flag= unsigned_flag && arg->unsigned_flag; -} diff --git a/sql/item_func.h b/sql/item_func.h index d4da0b7a853..6dcf32cba07 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -193,8 +193,6 @@ public: void * arg, traverse_order order); bool is_expensive_processor(byte *arg); virtual bool is_expensive() { return 0; } -protected: - void agg_num_lengths(Item *arg); }; -- cgit v1.2.1 From 5753307aefaf378db280fd53e2e58fa7ce3d2295 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 12 Dec 2008 14:52:20 +0200 Subject: Bug #41383 Test commit1_innodb fails with binlog-format=row The test explicitly warned on existence of a bug in its 27th part. The expected values of prepare and commit counters changed, corrected, by fixes to bug#40221. Notice, that binlog does not have to register for a statement with the statement binlog-format because the statement rollback does not need to do anything in that mode. It's not so with the ROW format which was bug#40221 concern. Fixed with correcting the expected values of the mentioned counters and explained that with comments in the test. mysql-test/include/commit.inc: Removing `Sic' that warned on a bug (The one is bug#40221). Correcting the expected values of prepare and commit counters due to fixes to bug#40221. mysql-test/r/commit_1innodb.result: results changed. --- mysql-test/include/commit.inc | 7 +++++-- mysql-test/r/commit_1innodb.result | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index 98f9c93b25a..48b0eac12e5 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -671,8 +671,11 @@ call p_verify_status_increment(2, 2, 2, 2); savepoint a; call p_verify_status_increment(0, 0, 0, 0); insert t1 set a=4; ---echo # Sic: a bug. Binlog did not register itself this time. -call p_verify_status_increment(1, 0, 1, 0); +--echo # Binlog does not register itself this time for other than the 1st +--echo # statement of the transaction with MIXED/STATEMENT binlog_format. +--echo # It needs registering with the ROW format. Therefore 1,0,2,2 are +--echo # the correct arguments to this test after bug#40221 fixed. +call p_verify_status_increment(1, 0, 2, 2); release savepoint a; rollback; call p_verify_status_increment(0, 0, 0, 0); diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index a2c1eb9a82e..766b920f630 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -770,8 +770,11 @@ call p_verify_status_increment(0, 0, 0, 0); SUCCESS insert t1 set a=4; -# Sic: a bug. Binlog did not register itself this time. -call p_verify_status_increment(1, 0, 1, 0); +# Binlog does not register itself this time for other than the 1st +# statement of the transaction with MIXED/STATEMENT binlog_format. +# It needs registering with the ROW format. Therefore 1,0,2,2 are +# the correct arguments to this test after bug#40221 fixed. +call p_verify_status_increment(1, 0, 2, 2); SUCCESS release savepoint a; -- cgit v1.2.1 From af5cf536bc5246e49a4874a225931a838659cae0 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Fri, 12 Dec 2008 17:16:25 +0400 Subject: Bug #40761: Assert on sum function on IF(..., CAST(longtext AS UNSIGNED), signed_val) (was: LEFT JOIN on inline view crashes server) Select from a LONGTEXT column wrapped with an expression like "IF(..., CAST(longtext_column AS UNSIGNED), smth_signed)" failed an assertion or crashed the server. IFNULL function was affected too. LONGTEXT column item has a maximum length of 32^2-1 bytes, at the same time this is a maximum possible length of any MySQL item. CAST(longtext_column AS UNSIGNED) returns some unsigned numeric result of length 32^2-1, so the result of IF/IFNULL function of this number and some other signed number will have text length of (32^2-1)+1=32^2 (one byte for the minus sign) - there is integer overflow, and the length is equal to zero. That caused assert/crash. CAST AS UNSIGNED function has been modified to limit maximal length of resulting number to 67 (maximal length of DECIMAL and two characters for minus sign and dot). mysql-test/r/func_if.result: Added test case for bug #40761. mysql-test/t/func_if.test: Added test case for bug #40761. sql/item_func.h: Bug #40761: Assert on sum function on IF(..., CAST(longtext AS UNSIGNED), signed_val) CAST AS UNSIGNED function has been modified to limit maximal length of resulting number to 67 (maximal length of DECIMAL and two characters for minus sign and dot). --- mysql-test/r/func_if.result | 9 +++++++++ mysql-test/t/func_if.test | 14 ++++++++++++++ sql/item_func.h | 5 ++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 7ffc957e285..16d6b435dc7 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -176,4 +176,13 @@ IF((ROUND(t1.a,2)=1), 2, IF((ROUND(t1.a,2)=1), 2, IF((R DROP TABLE t1; +CREATE TABLE t1 (c LONGTEXT); +INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890'); +SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +MAX(IF(1, CAST(c AS UNSIGNED), 0)) +12345678901234567890 +SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +MAX(IFNULL(CAST(c AS UNSIGNED), 0)) +12345678901234567890 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 8da10f36cbe..4efea8e195e 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -150,4 +150,18 @@ FROM t1; DROP TABLE t1; +# +# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed) +# (was: LEFT JOIN on inline view crashes server) +# + +CREATE TABLE t1 (c LONGTEXT); +INSERT INTO t1 VALUES(1), (2), (3), (4), ('12345678901234567890'); + +SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te; +SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te; + +DROP TABLE t1; + + --echo End of 5.0 tests diff --git a/sql/item_func.h b/sql/item_func.h index 6dcf32cba07..89c841abb75 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -351,7 +351,10 @@ public: Item_func_unsigned(Item *a) :Item_func_signed(a) {} const char *func_name() const { return "cast_as_unsigned"; } void fix_length_and_dec() - { max_length=args[0]->max_length; unsigned_flag=1; } + { + max_length= min(args[0]->max_length, DECIMAL_MAX_PRECISION + 2); + unsigned_flag=1; + } longlong val_int(); void print(String *str); }; -- cgit v1.2.1 From fd414261914e16d5feaa5037591336b02dd5521f Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 12 Dec 2008 15:10:56 +0100 Subject: Bug #31983 Running mysql-test from RPM fails for NDB Added $glob_basedir/sbin to search path for relevant binaries --- mysql-test/mysql-test-run.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 268dd3fbd16..add0d6cc22e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1508,15 +1508,21 @@ sub executable_setup_ndb () { "$glob_basedir/storage/ndb", "$glob_basedir/bin"); + # Some might be found in sbin, not bin. + my $daemon_path= mtr_file_exists("$glob_basedir/ndb", + "$glob_basedir/storage/ndb", + "$glob_basedir/sbin", + "$glob_basedir/bin"); + $exe_ndbd= mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd", - "$ndb_path/ndbd"); + "$daemon_path/ndbd"); $exe_ndb_mgm= mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm", "$ndb_path/ndb_mgm"); $exe_ndb_mgmd= mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd", - "$ndb_path/ndb_mgmd"); + "$daemon_path/ndb_mgmd"); $exe_ndb_waiter= mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter", "$ndb_path/ndb_waiter"); -- cgit v1.2.1 From 54bf3474dc60aa3ba2edfa9ac16ca6d9e2694e8e Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 12 Dec 2008 21:15:56 +0200 Subject: Bug #41003 log_bin_trust_function_creators_func test explicitly warns on a bug in it The test 1. did not verify that CREATE FUNCTION shall fails in a case of active binlog and @@log_bin_trust_function_creators is zero if there is no DETERMINISTIC qualifier and super user privilege; 2. contained an explit warning on that CREATE FUNCTION actually succeeded whereas it was supposed to fail; 3. did not demand the bin-log be set ON even though it has contained the opt file explictily setting the name for the binlog file. Fixed 1-3 with modifying the test accordingly. mysql-test/r/log_bin_trust_function_creators_func.result: Bug #41003 changed results. mysql-test/t/log_bin_trust_function_creators_func-master.opt: removed unnecessary file, the specificly requested binlog file name was not used in the test. mysql-test/t/log_bin_trust_function_creators_func.test: corrected the test that previously: 1. did not verify that CREATE FUNCTION shall fail in some cases; 2. contained an explit warning on that CREATE FUNCTION actually --- .../r/log_bin_trust_function_creators_func.result | 25 +++++++++++++---- ...log_bin_trust_function_creators_func-master.opt | 1 - .../t/log_bin_trust_function_creators_func.test | 32 +++++++++++++++++++--- 3 files changed, 47 insertions(+), 11 deletions(-) delete mode 100644 mysql-test/t/log_bin_trust_function_creators_func-master.opt diff --git a/mysql-test/r/log_bin_trust_function_creators_func.result b/mysql-test/r/log_bin_trust_function_creators_func.result index e109b53a8e7..50de0466a0d 100644 --- a/mysql-test/r/log_bin_trust_function_creators_func.result +++ b/mysql-test/r/log_bin_trust_function_creators_func.result @@ -10,10 +10,7 @@ create table t2 (a INT); SELECT @@log_bin_trust_function_creators; @@log_bin_trust_function_creators 0 -SELECT @@sql_log_bin; -@@sql_log_bin -1 -## Creating new function f1 ## +## Creating new function f1 fails because no DETERMINISTIC ### CREATE FUNCTION f1(a INT) RETURNS INT BEGIN IF (a < 3) THEN @@ -21,8 +18,24 @@ INSERT INTO t2 VALUES (a); END IF; RETURN 1; END| -'Bug: Create Function should give error here because non-super user'; -'is creating function here'; +ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +## Creating new function f1 fails because non-super user ## +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN +IF (a < 3) THEN +INSERT INTO t2 VALUES (a); +END IF; +RETURN 1; +END| +ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +## Creating new function f1 succeeds ## +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN +IF (a < 3) THEN +INSERT INTO t2 VALUES (a); +END IF; +RETURN 1; +END| ## Creating new table t1 ## CREATE TABLE t1 (a INT); ## Inserting some records in t1 ## diff --git a/mysql-test/t/log_bin_trust_function_creators_func-master.opt b/mysql-test/t/log_bin_trust_function_creators_func-master.opt deleted file mode 100644 index 2dd562ea1aa..00000000000 --- a/mysql-test/t/log_bin_trust_function_creators_func-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin=test.log diff --git a/mysql-test/t/log_bin_trust_function_creators_func.test b/mysql-test/t/log_bin_trust_function_creators_func.test index db91128b225..38207babc03 100644 --- a/mysql-test/t/log_bin_trust_function_creators_func.test +++ b/mysql-test/t/log_bin_trust_function_creators_func.test @@ -20,6 +20,8 @@ # # ############################################################################### +source include/have_log_bin.inc; + --disable_warnings drop table if exists t1; --enable_warnings @@ -45,10 +47,10 @@ connect (test_con1,localhost,tt,,); connection test_con1; SELECT @@log_bin_trust_function_creators; -SELECT @@sql_log_bin; ---echo ## Creating new function f1 ## +--echo ## Creating new function f1 fails because no DETERMINISTIC ### delimiter |; +--error ER_BINLOG_UNSAFE_ROUTINE CREATE FUNCTION f1(a INT) RETURNS INT BEGIN IF (a < 3) THEN @@ -58,8 +60,30 @@ BEGIN END| delimiter ;| ---echo 'Bug: Create Function should give error here because non-super user'; ---echo 'is creating function here'; +--echo ## Creating new function f1 fails because non-super user ## +delimiter |; +--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN + IF (a < 3) THEN + INSERT INTO t2 VALUES (a); + END IF; + RETURN 1; +END| +delimiter ;| + +connection default; + +--echo ## Creating new function f1 succeeds ## +delimiter |; +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN + IF (a < 3) THEN + INSERT INTO t2 VALUES (a); + END IF; + RETURN 1; +END| +delimiter ;| --echo ## Creating new table t1 ## CREATE TABLE t1 (a INT); -- cgit v1.2.1 From c89393bb64aea830393c1e9d6392b55703c5a72a Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Fri, 12 Dec 2008 15:48:26 -0700 Subject: Apply the rest of innodb-5.0-ss2475. This fixes Bug#36819, "ut_usectime does not handle errors from gettimeofday". r2475 | vasil | 2008-05-22 19:35:30 +0300 (Thu, 22 May 2008) | 13 lines Fix by retrying gettimeofday() several times if it fails in ut_usectime(). If it fails on all calls then return error to the caller to be handled at higher level. Update the variable innodb_row_lock_time_max in SHOW STATUS output only if ut_usectime() was successful. --- innobase/btr/btr0cur.c | 2 +- innobase/include/ut0ut.h | 8 ++++++-- innobase/srv/srv0srv.c | 21 +++++++++++++++------ innobase/ut/ut0ut.c | 36 +++++++++++++++++++++++++++++++----- 4 files changed, 53 insertions(+), 14 deletions(-) diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index d51a090be75..509b2ba3119 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -52,7 +52,7 @@ can be released by page reorganize, then it is reorganized */ #define BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32) -/* When estimating number of different kay values in an index sample +/* When estimating number of different key values in an index, sample this many index pages */ #define BTR_KEY_VAL_ESTIMATE_N_PAGES 8 diff --git a/innobase/include/ut0ut.h b/innobase/include/ut0ut.h index 8938957cd12..b1c1602fd30 100644 --- a/innobase/include/ut0ut.h +++ b/innobase/include/ut0ut.h @@ -139,11 +139,15 @@ ib_time_t ut_time(void); /*=========*/ /************************************************************** -Returns system time. */ +Returns system time. +Upon successful completion, the value 0 is returned; otherwise the +value -1 is returned and the global variable errno is set to indicate the +error. */ -void +int ut_usectime( /*========*/ + /* out: 0 on success, -1 otherwise */ ulint* sec, /* out: seconds since the Epoch */ ulint* ms); /* out: microseconds since the Epoch+*sec */ /************************************************************** diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 431138400b6..6b755ae9816 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -1372,7 +1372,7 @@ srv_table_reserve_slot_for_mysql(void) /******************************************************************* Puts a MySQL OS thread to wait for a lock to be released. If an error -occurs during the wait trx->error_state associated with thr is +occurs during the wait, then trx->error_state associated with thr is != DB_SUCCESS when we return. DB_LOCK_WAIT_TIMEOUT and DB_DEADLOCK are possible errors. DB_DEADLOCK is returned if selective deadlock resolution chose this transaction as a victim. */ @@ -1442,8 +1442,11 @@ srv_suspend_mysql_thread( srv_n_lock_wait_count++; srv_n_lock_wait_current_count++; - ut_usectime(&sec, &ms); - start_time = (ib_longlong)sec * 1000000 + ms; + if (ut_usectime(&sec, &ms) == -1) { + start_time = -1; + } else { + start_time = (ib_longlong)sec * 1000000 + ms; + } } /* Wake the lock timeout monitor thread, if it is suspended */ @@ -1497,14 +1500,20 @@ srv_suspend_mysql_thread( wait_time = ut_difftime(ut_time(), slot->suspend_time); if (thr->lock_state == QUE_THR_LOCK_ROW) { - ut_usectime(&sec, &ms); - finish_time = (ib_longlong)sec * 1000000 + ms; + if (ut_usectime(&sec, &ms) == -1) { + finish_time = -1; + } else { + finish_time = (ib_longlong)sec * 1000000 + ms; + } diff_time = (ulint) (finish_time - start_time); srv_n_lock_wait_current_count--; srv_n_lock_wait_time = srv_n_lock_wait_time + diff_time; - if (diff_time > srv_n_lock_max_wait_time) { + if (diff_time > srv_n_lock_max_wait_time && + /* only update the variable if we successfully + retrieved the start and finish times. See Bug#36819. */ + start_time != -1 && finish_time != -1) { srv_n_lock_max_wait_time = diff_time; } } diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c index feb03269d91..b93838a1885 100644 --- a/innobase/ut/ut0ut.c +++ b/innobase/ut/ut0ut.c @@ -123,19 +123,45 @@ ut_time(void) } /************************************************************** -Returns system time. */ +Returns system time. +Upon successful completion, the value 0 is returned; otherwise the +value -1 is returned and the global variable errno is set to indicate the +error. */ -void +int ut_usectime( /*========*/ + /* out: 0 on success, -1 otherwise */ ulint* sec, /* out: seconds since the Epoch */ ulint* ms) /* out: microseconds since the Epoch+*sec */ { struct timeval tv; + int ret; + int errno_gettimeofday; + int i; + + for (i = 0; i < 10; i++) { + + ret = ut_gettimeofday(&tv, NULL); + + if (ret == -1) { + errno_gettimeofday = errno; + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: gettimeofday(): %s\n", + strerror(errno_gettimeofday)); + os_thread_sleep(100000); /* 0.1 sec */ + errno = errno_gettimeofday; + } else { + break; + } + } + + if (ret != -1) { + *sec = (ulint) tv.tv_sec; + *ms = (ulint) tv.tv_usec; + } - ut_gettimeofday(&tv, NULL); - *sec = (ulint) tv.tv_sec; - *ms = (ulint) tv.tv_usec; + return(ret); } /************************************************************** -- cgit v1.2.1 From a786fa6109fa3cdc11818190d3f02766072d4cc3 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Fri, 12 Dec 2008 17:40:31 -0700 Subject: Apply 3 patches from innodb-5.0-ss2637. This fixes Bug#36149: Read buffer overflow in srv0start.c found during "make test" Per-revision comments: r2484 | vasil | 2008-05-28 15:32:48 +0300 (Wed, 28 May 2008) | 9 lines Fix Bug#36149 Read buffer overflow in srv0start.c found during "make test" Use strncmp(3) instead of memcmp(3) to avoid reading past end of the string if it is empty (*str == '\0'). This bug is _not_ a buffer overflow. Discussed with: Sunny (via IM) r2538 | inaam | 2008-07-15 21:24:02 +0300 (Tue, 15 Jul 2008) | 15 lines Fix of issue# 4 Fixed a timing hole where a thread dropping an index can free the in-memory index struct while another thread is still using that structure to remove entries from adaptive hash index belonging to one of the pages that belongs to the index being dropped. The fix is to have a reference counter in the index struct and to wait for this counter to drop to zero beforing freeing the struct. Reviewed by: Heikki r2544 | inaam | 2008-07-22 18:58:11 +0300 (Tue, 22 Jul 2008) | 8 lines Removed UNIV_INLINE qualifier from btr_search_info_get_ref_count(). Otherwise compilation failed on non-debug builds. Pointed by: Vasil --- innobase/btr/btr0sea.c | 40 +++++++++++++++++++++++++++++++++++++++ innobase/dict/dict0dict.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ innobase/include/btr0sea.h | 21 +++++++++++++++++++-- innobase/srv/srv0start.c | 8 ++++---- 4 files changed, 110 insertions(+), 6 deletions(-) diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c index ed746bcf12c..3c202c5a3bf 100644 --- a/innobase/btr/btr0sea.c +++ b/innobase/btr/btr0sea.c @@ -162,6 +162,8 @@ btr_search_info_create( info->last_search = NULL; info->n_direction = 0; + + info->ref_count = 0; info->root_guess = NULL; info->hash_analysis = 0; @@ -183,6 +185,31 @@ btr_search_info_create( return(info); } +/********************************************************************* +Returns the value of ref_count. The value is protected by +btr_search_latch. */ +ulint +btr_search_info_get_ref_count( +/*==========================*/ + /* out: ref_count value. */ + btr_search_t* info) /* in: search info. */ +{ + ulint ret; + + ut_ad(info); + +#ifdef UNIV_SYNC_DEBUG + ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); + ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); +#endif /* UNIV_SYNC_DEBUG */ + + rw_lock_s_lock(&btr_search_latch); + ret = info->ref_count; + rw_lock_s_unlock(&btr_search_latch); + + return(ret); +} + /************************************************************************* Updates the search info of an index about hash successes. NOTE that info is NOT protected by any semaphore, to save CPU time! Do not assume its fields @@ -1019,8 +1046,12 @@ next_rec: ha_remove_all_nodes_to_page(table, folds[i], page); } + ut_a(index->search_info->ref_count > 0); + index->search_info->ref_count--; + block->is_hashed = FALSE; block->index = NULL; + cleanup: if (UNIV_UNLIKELY(block->n_pointers)) { /* Corruption */ @@ -1241,6 +1272,15 @@ btr_search_build_page_hash_index( goto exit_func; } + /* This counter is decremented every time we drop page + hash index entries and is incremented here. Since we can + rebuild hash index for a page that is already hashed, we + have to take care not to increment the counter in that + case. */ + if (!block->is_hashed) { + index->search_info->ref_count++; + } + block->is_hashed = TRUE; block->n_hash_helps = 0; diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index b8d9f362b06..b0d95597153 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -1556,6 +1556,8 @@ dict_index_remove_from_cache( dict_field_t* field; ulint size; ulint i; + ulint retries = 0; + btr_search_t* info; ut_ad(table && index); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); @@ -1564,6 +1566,51 @@ dict_index_remove_from_cache( ut_ad(mutex_own(&(dict_sys->mutex))); #endif /* UNIV_SYNC_DEBUG */ + /* We always create search info whether or not adaptive + hash index is enabled or not. */ + info = index->search_info; + ut_ad(info); + + /* We are not allowed to free the in-memory index struct + dict_index_t until all entries in the adaptive hash index + that point to any of the page belonging to his b-tree index + are dropped. This is so because dropping of these entries + require access to dict_index_t struct. To avoid such scenario + We keep a count of number of such pages in the search_info and + only free the dict_index_t struct when this count drops to + zero. */ + + for (;;) { + ulint ref_count = btr_search_info_get_ref_count(info); + if (ref_count == 0) { + break; + } + + /* Sleep for 10ms before trying again. */ + os_thread_sleep(10000); + ++retries; + + if (retries % 500 == 0) { + /* No luck after 5 seconds of wait. */ + fprintf(stderr, "InnoDB: Error: Waited for" + " %lu secs for hash index" + " ref_count (%lu) to drop" + " to 0.\n" + "index: \"%s\"" + " table: \"%s\"\n", + retries/100, + ref_count, + index->name, + table->name); + } + + /* To avoid a hang here we commit suicide if the + ref_count doesn't drop to zero in 600 seconds. */ + if (retries >= 60000) { + ut_error; + } + } + ut_ad(UT_LIST_GET_LEN((index->tree)->tree_indexes) == 1); dict_tree_free(index->tree); diff --git a/innobase/include/btr0sea.h b/innobase/include/btr0sea.h index 78e88a24083..370132af60d 100644 --- a/innobase/include/btr0sea.h +++ b/innobase/include/btr0sea.h @@ -40,6 +40,14 @@ btr_search_info_create( /*===================*/ /* out, own: search info struct */ mem_heap_t* heap); /* in: heap where created */ +/********************************************************************* +Returns the value of ref_count. The value is protected by +btr_search_latch. */ +ulint +btr_search_info_get_ref_count( +/*==========================*/ + /* out: ref_count value. */ + btr_search_t* info); /* in: search info. */ /************************************************************************* Updates the search info. */ UNIV_INLINE @@ -144,6 +152,13 @@ btr_search_validate(void); struct btr_search_struct{ ulint magic_n; /* magic number */ + ulint ref_count; /* Number of blocks in this index tree + that have search index built + i.e. block->index points to this index. + Protected by btr_search_latch except + when during initialization in + btr_search_info_create(). */ + /* The following 4 fields are currently not used: */ rec_t* last_search; /* pointer to the lower limit record of the previous search; NULL if not known */ @@ -154,8 +169,10 @@ struct btr_search_struct{ or BTR_SEA_SAME_PAGE */ dulint modify_clock; /* value of modify clock at the time last_search was stored */ - /*----------------------*/ - /* The following 4 fields are not protected by any latch: */ + + /* The following fields are not protected by any latch. + Unfortunately, this means that they must be aligned to + the machine word, i.e., they cannot be turned into bit-fields. */ page_t* root_guess; /* the root page frame when it was last time fetched, or NULL */ ulint hash_analysis; /* when this exceeds a certain value, the diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 5f8707a661c..d380eb14710 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -180,11 +180,11 @@ srv_parse_data_file_paths_and_sizes( str++; } - if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) { + if (0 == strncmp(str, ":autoextend", (sizeof ":autoextend") - 1)) { str += (sizeof ":autoextend") - 1; - if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) { + if (0 == strncmp(str, ":max:", (sizeof ":max:") - 1)) { str += (sizeof ":max:") - 1; @@ -288,13 +288,13 @@ srv_parse_data_file_paths_and_sizes( (*data_file_names)[i] = path; (*data_file_sizes)[i] = size; - if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) { + if (0 == strncmp(str, ":autoextend", (sizeof ":autoextend") - 1)) { *is_auto_extending = TRUE; str += (sizeof ":autoextend") - 1; - if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) { + if (0 == strncmp(str, ":max:", (sizeof ":max:") - 1)) { str += (sizeof ":max:") - 1; -- cgit v1.2.1 From 001aaedcb662adb2955fa9cd705ba0906ddea2a5 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Fri, 12 Dec 2008 17:42:34 -0700 Subject: r2629 | inaam | 2008-09-16 18:46:00 +0300 (Tue, 16 Sep 2008) | 9 lines branches/5.0 bug#39483 InnoDB hang on adaptive hash because of out of order ::open() call by MySQL Under some conditions MySQL calls ::open with search_latch leading to a deadlock as we try to acquire dict_sys->mutex inside ::open breaking the latching order. The fix is to release search_latch. Reviewed by: Heikki --- sql/ha_innodb.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 1c0f8a6e9b3..83e2d025f18 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -2158,6 +2158,14 @@ ha_innobase::open( UT_NOT_USED(test_if_locked); thd = current_thd; + + /* Under some cases MySQL seems to call this function while + holding btr_search_latch. This breaks the latching order as + we acquire dict_sys->mutex below and leads to a deadlock. */ + if (thd != NULL) { + innobase_release_temporary_latches(thd); + } + normalize_table_name(norm_name, name); user_thd = NULL; -- cgit v1.2.1 From 040f3e9e5b8187e8d00c59847f5b8335bdf2f4fb Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 11:24:16 -0700 Subject: Completing snapshot innodb-5.1-ss2438, part 1. Fixes Bug #35537: Innodb doesn't increment handler_update and handler_delete Detailed revision comments: r2388 | vasil | 2008-03-27 14:02:34 +0200 (Thu, 27 Mar 2008) | 7 lines branches/5.1: Swap the order in which mysql_thd, mysql_query_str and *mysql_query_str are checked for non-NULL. Suggested by: Marko r2421 | calvin | 2008-04-24 15:32:30 +0300 (Thu, 24 Apr 2008) | 6 lines branches/5.1: Fix bug#35537 - Innodb doesn't increment handler_update and handler_delete Add the calls to ha_statistic_increment() in ha_innobase::delete_row() and ha_innobase::update_row(). --- mysql-test/r/innodb.result | 8 ++++++++ mysql-test/t/innodb.test | 31 +++++++++++++++++++++++++++++++ storage/innobase/handler/ha_innodb.cc | 4 ++++ storage/innobase/row/row0sel.c | 4 ++-- 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 5f8c59b9a0c..7806262f052 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -3295,3 +3295,11 @@ info: Records: 5 Duplicates: 0 Warnings: 0 TRUNCATE TABLE t1; affected rows: 0 DROP TABLE t1; +Variable_name Value +Handler_update 0 +Variable_name Value +Handler_delete 0 +Variable_name Value +Handler_update 1 +Variable_name Value +Handler_delete 1 diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 339be87419a..eaff5867dc3 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -2475,6 +2475,7 @@ SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; DROP TABLE t2; DROP TABLE t1; # End 34920 test +# # Bug #29507 TRUNCATE shows to many rows effected # CONNECTION default; @@ -2491,6 +2492,36 @@ TRUNCATE TABLE t1; --disable_info DROP TABLE t1; # +# Bug#35537 Innodb doesn't increment handler_update and handler_delete. +# +-- disable_query_log +-- disable_result_log + +CONNECT (c1,localhost,root,,); + +DROP TABLE IF EXISTS bug35537; +CREATE TABLE bug35537 ( + c1 int +) ENGINE=InnoDB; + +INSERT INTO bug35537 VALUES (1); + +-- enable_result_log + +SHOW SESSION STATUS LIKE 'Handler_update%'; +SHOW SESSION STATUS LIKE 'Handler_delete%'; + +UPDATE bug35537 SET c1 = 2 WHERE c1 = 1; +DELETE FROM bug35537 WHERE c1 = 2; + +SHOW SESSION STATUS LIKE 'Handler_update%'; +SHOW SESSION STATUS LIKE 'Handler_delete%'; + +DROP TABLE bug35537; + +DISCONNECT c1; +CONNECTION default; + ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 887acacbd1f..cd2b121cbf4 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3755,6 +3755,8 @@ ha_innobase::update_row( ut_a(prebuilt->trx == trx); + ha_statistic_increment(&SSV::ha_update_count); + if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) table->timestamp_field->set_time(); @@ -3844,6 +3846,8 @@ ha_innobase::delete_row( ut_a(prebuilt->trx == trx); + ha_statistic_increment(&SSV::ha_delete_count); + /* Only if the table has an AUTOINC column */ if (table->found_next_number_field && record == table->record[0]) { ulonglong dummy = 0; diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 6ff135e4f5a..c6a93d4e0d5 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3577,9 +3577,9 @@ shortcut_fails_too_big_rec: if (trx->isolation_level <= TRX_ISO_READ_COMMITTED && prebuilt->select_lock_type != LOCK_NONE + && trx->mysql_thd != NULL && trx->mysql_query_str != NULL - && *trx->mysql_query_str != NULL - && trx->mysql_thd != NULL) { + && *trx->mysql_query_str != NULL) { /* Scan the MySQL query string; check if SELECT is the first word there */ -- cgit v1.2.1 From e361d4487bab23b1b9b17937c2eff89f1e059d4d Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 11:26:53 -0700 Subject: Completing snapshot innodb-5.1-ss2438, part 2. Fixes Bug #36169: create innodb compressed table with too large row size crashed Revision comments: r2422 | vasil | 2008-04-24 16:00:30 +0300 (Thu, 24 Apr 2008) | 11 lines branches/5.1: Fix Bug#36169 create innodb compressed table with too large row size crashed Sometimes it is possible that row_drop_table_for_mysql(index->table_name, trx, FALSE); is invoked in row_create_index_for_mysql() when the index object is freed so copy the table name to a safe place beforehand and use the copy. Approved by: Sunny --- storage/innobase/row/row0mysql.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index d5ef12d0af2..f5228618a04 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -1963,6 +1963,7 @@ row_create_index_for_mysql( ulint err; ulint i, j; ulint len; + char* table_name; #ifdef UNIV_SYNC_DEBUG ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); @@ -1972,6 +1973,11 @@ row_create_index_for_mysql( trx->op_info = "creating index"; + /* Copy the table name because we may want to drop the + table later, after the index object is freed (inside + que_run_threads()) and thus index->table_name is not available. */ + table_name = mem_strdup(index->table_name); + trx_start_if_not_started(trx); /* Check that the same column does not appear twice in the index. @@ -2044,13 +2050,15 @@ error_handling: trx_general_rollback_for_mysql(trx, FALSE, NULL); - row_drop_table_for_mysql(index->table_name, trx, FALSE); + row_drop_table_for_mysql(table_name, trx, FALSE); trx->error_state = DB_SUCCESS; } trx->op_info = ""; + mem_free(table_name); + return((int) err); } -- cgit v1.2.1 From 25f3574a4f535a86a279b0eb368879e45607fbce Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 11:54:01 -0700 Subject: Completing snapshot innodb-5.1-ss2438, part 3. Changes to plug.in structure, some INNODB_CFLAGS improvements for better maintenance, and some comments and whitespace changes. Detailed revision comments: r2433 | vasil | 2008-04-30 12:02:35 +0300 (Wed, 30 Apr 2008) | 5 lines branches/5.1: Add vim modeline to hint it that plug.in is a config file so it can be colorized. r2429 | vasil | 2008-04-30 11:19:06 +0300 (Wed, 30 Apr 2008) | 10 lines branches/5.1: * Use INNODB_CFLAGS insead of cluttering CFLAGS with InnoDB specific flags. CFLAGS are used to compile every file in the MySQL source tree. * Add INNODB_DYNAMIC_CFLAGS to the flags of the dynamic plugin and use -prefer-non-pic to make the dynamic plugin faster on i386. Approved by: Sunny r2430 | vasil | 2008-04-30 11:48:35 +0300 (Wed, 30 Apr 2008) | 8 lines branches/5.1: Use CFLAGS instead of INNODB_CFLAGS to avoid having incompatible flags inserted in CFLAGS and INNODB_CFLAGS and to avoid compiling mysql and innodb with different flags. Discussed with: Sunny r2431 | vasil | 2008-04-30 11:54:49 +0300 (Wed, 30 Apr 2008) | 4 lines branches/5.1: Fix r2430, it should be CFLAGS="$CFLAGS ..." not CFLAGS="..." r2432 | vasil | 2008-04-30 11:58:38 +0300 (Wed, 30 Apr 2008) | 4 lines branches/5.1: Non-functional change: use tabs for indentation in plug.in. r2436 | vasil | 2008-04-30 19:15:46 +0300 (Wed, 30 Apr 2008) | 7 lines branches/5.1: Non-functional white space change in Makefile.am: Use tabs for indentation and be consistent about spaces around the equal sign. --- storage/innobase/Makefile.am | 38 +++++++++++++++++++------------------- storage/innobase/plug.in | 43 ++++++++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index b5e5c5375dc..7410bf7e591 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -15,21 +15,21 @@ # Process this file with automake to create Makefile.in -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ +MYSQLDATAdir= $(localstatedir) +MYSQLSHAREdir= $(pkgdatadir) +MYSQLBASEdir= $(prefix) +MYSQLLIBdir= $(pkglibdir) +pkgplugindir= $(pkglibdir)/plugin +INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \ -I$(top_srcdir)/regex \ -I$(top_srcdir)/storage/innobase/include \ -I$(top_srcdir)/sql \ - -I$(srcdir) + -I$(srcdir) -DEFS = @DEFS@ +DEFS= @DEFS@ -noinst_HEADERS = include/btr0btr.h include/btr0btr.ic \ +noinst_HEADERS= include/btr0btr.h include/btr0btr.ic \ include/btr0cur.h include/btr0cur.ic \ include/btr0pcur.h include/btr0pcur.ic \ include/btr0sea.h include/btr0sea.ic \ @@ -121,9 +121,9 @@ noinst_HEADERS = include/btr0btr.h include/btr0btr.ic \ include/ut0list.ic include/ut0wqueue.h \ include/ha_prototypes.h handler/ha_innodb.h -EXTRA_LIBRARIES = libinnobase.a -noinst_LIBRARIES = @plugin_innobase_static_target@ -libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ +EXTRA_LIBRARIES= libinnobase.a +noinst_LIBRARIES= @plugin_innobase_static_target@ +libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ btr/btr0sea.c buf/buf0buf.c buf/buf0flu.c \ buf/buf0lru.c buf/buf0rea.c data/data0data.c \ data/data0type.c dict/dict0boot.c \ @@ -156,17 +156,17 @@ libinnobase_a_SOURCES = btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ handler/ha_innodb.cc libinnobase_a_CXXFLAGS= $(AM_CFLAGS) -libinnobase_a_CFLAGS = $(AM_CFLAGS) +libinnobase_a_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES = ha_innodb.la +EXTRA_LTLIBRARIES= ha_innodb.la pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ -ha_innodb_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_innodb_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_innodb_la_SOURCES = $(libinnobase_a_SOURCES) +ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) +ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES) -EXTRA_DIST = CMakeLists.txt plug.in \ +EXTRA_DIST= CMakeLists.txt plug.in \ pars/make_bison.sh pars/make_flex.sh \ pars/pars0grm.y pars/pars0lex.l diff --git a/storage/innobase/plug.in b/storage/innobase/plug.in index b252d471fba..f7d2abed751 100644 --- a/storage/innobase/plug.in +++ b/storage/innobase/plug.in @@ -15,25 +15,30 @@ MYSQL_PLUGIN_ACTIONS(innobase, [ AC_CHECK_FUNCS(localtime_r) AC_C_BIGENDIAN case "$target_os" in - lin*) - CFLAGS="$CFLAGS -DUNIV_LINUX";; - hpux10*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";; - hp*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";; - aix*) - CFLAGS="$CFLAGS -DUNIV_AIX";; - irix*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - osf*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - *solaris*|*SunOS*) - CFLAGS="$CFLAGS -DUNIV_SOLARIS";; - sysv5uw7*) - # Problem when linking on SCO - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - openbsd*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; + lin*) + CFLAGS="$CFLAGS -DUNIV_LINUX";; + hpux10*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";; + hp*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";; + aix*) + CFLAGS="$CFLAGS -DUNIV_AIX";; + irix*|osf*|sysv5uw7*|openbsd*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; + *solaris*|*SunOS*) + CFLAGS="$CFLAGS -DUNIV_SOLARIS";; esac + INNODB_DYNAMIC_CFLAGS="-DMYSQL_DYNAMIC_PLUGIN" + case "$target_cpu" in + x86_64) + # The AMD64 ABI forbids absolute addresses in shared libraries + ;; + *86) + # Use absolute addresses on IA-32 + INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic" + ;; + esac + AC_SUBST(INNODB_DYNAMIC_CFLAGS) ]) +# vim: set ft=config: -- cgit v1.2.1 From 1945f661f7b4baf57bb7a95222f70a7d14544a5a Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 12:15:12 -0700 Subject: Complete applying InnoDB snapshot innodb-5.1-ss2479. Fixes Bug #11894: innodb_file_per_table crashes w/ Windows .sym symbolic link hack Detailed revision comments: r2466 | calvin | 2008-05-20 01:37:14 +0300 (Tue, 20 May 2008) | 12 lines branches/5.1: Fix Bug#11894 innodb_file_per_table crashes w/ Windows .sym symbolic link hack The crash was due to un-handled error 3 (path not found). In the case of file per table, change the call to os_file_handle_error_no_exit() from os_file_handle_error(). Also, checks for full path pattern during table create (Windows only), which is used in symbolic link and temp table creation. Approved by: Heikki --- storage/innobase/handler/ha_innodb.cc | 23 +++++++++++++++++++++++ storage/innobase/os/os0file.c | 32 ++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index cd2b121cbf4..4b7c5b1246a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4990,6 +4990,29 @@ ha_innobase::create( DBUG_ENTER("ha_innobase::create"); DBUG_ASSERT(thd != NULL); + DBUG_ASSERT(create_info != NULL); + +#ifdef __WIN__ + /* Names passed in from server are in two formats: + 1. /: for normal table creation + 2. full path: for temp table creation, or sym link + + When srv_file_per_table is on, check for full path pattern, i.e. + X:\dir\..., X is a driver letter, or + \\dir1\dir2\..., UNC path + returns error if it is in full path format, but not creating a temp. + table. Currently InnoDB does not support symbolic link on Windows. */ + + if (srv_file_per_table + && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) { + + if ((name[1] == ':') + || (name[0] == '\\' && name[1] == '\\')) { + sql_print_error("Cannot create table %s\n", name); + DBUG_RETURN(HA_ERR_GENERIC); + } + } +#endif if (form->s->fields > 1000) { /* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020, diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 9adb9ddac50..8fd959512c1 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -1267,9 +1267,19 @@ try_again: if (file == INVALID_HANDLE_VALUE) { *success = FALSE; - retry = os_file_handle_error(name, - create_mode == OS_FILE_CREATE ? - "create" : "open"); + /* When srv_file_per_table is on, file creation failure may not + be critical to the whole instance. Do not crash the server in + case of unknown errors. */ + if (srv_file_per_table) { + retry = os_file_handle_error_no_exit(name, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } else { + retry = os_file_handle_error(name, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } + if (retry) { goto try_again; } @@ -1344,9 +1354,19 @@ try_again: if (file == -1) { *success = FALSE; - retry = os_file_handle_error(name, - create_mode == OS_FILE_CREATE ? - "create" : "open"); + /* When srv_file_per_table is on, file creation failure may not + be critical to the whole instance. Do not crash the server in + case of unknown errors. */ + if (srv_file_per_table) { + retry = os_file_handle_error_no_exit(name, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } else { + retry = os_file_handle_error(name, + create_mode == OS_FILE_CREATE ? + "create" : "open"); + } + if (retry) { goto try_again; } else { -- cgit v1.2.1 From efbac9aabc7245afa12b3ec954ff4b65766cc2d1 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 12:18:59 -0700 Subject: Complete application of InnoDB snapshot innodb-5.1-ss2485, part 1. Fixes Bug #36819: ut_usectime does not handle errors from gettimeofday Detailed revision comments: r2480 | vasil | 2008-05-27 11:40:07 +0300 (Tue, 27 May 2008) | 11 lines branches/5.1: Fix Bug#36819 ut_usectime does not handle errors from gettimeofday by retrying gettimeofday() several times if it fails in ut_usectime(). If it fails on all calls then return error to the caller to be handled at higher level. Update the variable innodb_row_lock_time_max in SHOW STATUS output only if ut_usectime() was successful. --- storage/innobase/include/ut0ut.h | 8 ++++++-- storage/innobase/srv/srv0srv.c | 19 ++++++++++++++----- storage/innobase/ut/ut0ut.c | 36 +++++++++++++++++++++++++++++++----- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index a60ce73c35a..8ad1782b178 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -145,11 +145,15 @@ ib_time_t ut_time(void); /*=========*/ /************************************************************** -Returns system time. */ +Returns system time. +Upon successful completion, the value 0 is returned; otherwise the +value -1 is returned and the global variable errno is set to indicate the +error. */ -void +int ut_usectime( /*========*/ + /* out: 0 on success, -1 otherwise */ ulint* sec, /* out: seconds since the Epoch */ ulint* ms); /* out: microseconds since the Epoch+*sec */ /************************************************************** diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index 773b5d583e0..e8b7bd4cee2 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -1453,8 +1453,11 @@ srv_suspend_mysql_thread( srv_n_lock_wait_count++; srv_n_lock_wait_current_count++; - ut_usectime(&sec, &ms); - start_time = (ib_longlong)sec * 1000000 + ms; + if (ut_usectime(&sec, &ms) == -1) { + start_time = -1; + } else { + start_time = (ib_longlong)sec * 1000000 + ms; + } } /* Wake the lock timeout monitor thread, if it is suspended */ @@ -1508,14 +1511,20 @@ srv_suspend_mysql_thread( wait_time = ut_difftime(ut_time(), slot->suspend_time); if (thr->lock_state == QUE_THR_LOCK_ROW) { - ut_usectime(&sec, &ms); - finish_time = (ib_longlong)sec * 1000000 + ms; + if (ut_usectime(&sec, &ms) == -1) { + finish_time = -1; + } else { + finish_time = (ib_longlong)sec * 1000000 + ms; + } diff_time = (ulint) (finish_time - start_time); srv_n_lock_wait_current_count--; srv_n_lock_wait_time = srv_n_lock_wait_time + diff_time; - if (diff_time > srv_n_lock_max_wait_time) { + if (diff_time > srv_n_lock_max_wait_time && + /* only update the variable if we successfully + retrieved the start and finish times. See Bug#36819. */ + start_time != -1 && finish_time != -1) { srv_n_lock_max_wait_time = diff_time; } } diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c index 1ca278cd633..6b5bcef1830 100644 --- a/storage/innobase/ut/ut0ut.c +++ b/storage/innobase/ut/ut0ut.c @@ -112,19 +112,45 @@ ut_time(void) } /************************************************************** -Returns system time. */ +Returns system time. +Upon successful completion, the value 0 is returned; otherwise the +value -1 is returned and the global variable errno is set to indicate the +error. */ -void +int ut_usectime( /*========*/ + /* out: 0 on success, -1 otherwise */ ulint* sec, /* out: seconds since the Epoch */ ulint* ms) /* out: microseconds since the Epoch+*sec */ { struct timeval tv; + int ret; + int errno_gettimeofday; + int i; + + for (i = 0; i < 10; i++) { + + ret = ut_gettimeofday(&tv, NULL); + + if (ret == -1) { + errno_gettimeofday = errno; + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: gettimeofday(): %s\n", + strerror(errno_gettimeofday)); + os_thread_sleep(100000); /* 0.1 sec */ + errno = errno_gettimeofday; + } else { + break; + } + } + + if (ret != -1) { + *sec = (ulint) tv.tv_sec; + *ms = (ulint) tv.tv_usec; + } - ut_gettimeofday(&tv, NULL); - *sec = (ulint) tv.tv_sec; - *ms = (ulint) tv.tv_usec; + return(ret); } /************************************************************** -- cgit v1.2.1 From 1c0d9aa0825ec1341a31433d3f05e56f22def977 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 12:21:24 -0700 Subject: Complete application of InnoDB snapshot innodb-5.1-ss2485, part 2. Fixes Bug #36149: Read buffer overflow in srv0start.c found during "make test" Detailed revision comments: r2485 | vasil | 2008-05-28 16:01:14 +0300 (Wed, 28 May 2008) | 9 lines branches/5.1: Fix Bug#36149 Read buffer overflow in srv0start.c found during "make test" Use strncmp(3) instead of memcmp(3) to avoid reading past end of the string if it is empty (*str == '\0'). This bug is _not_ a buffer overflow. Discussed with: Sunny (via IM) --- storage/innobase/srv/srv0start.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 979d882307a..ea88039f3dd 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -202,13 +202,13 @@ srv_parse_data_file_paths_and_sizes( str = srv_parse_megabytes(str, &size); - if (0 == memcmp(str, ":autoextend", - (sizeof ":autoextend") - 1)) { + if (0 == strncmp(str, ":autoextend", + (sizeof ":autoextend") - 1)) { str += (sizeof ":autoextend") - 1; - if (0 == memcmp(str, ":max:", - (sizeof ":max:") - 1)) { + if (0 == strncmp(str, ":max:", + (sizeof ":max:") - 1)) { str += (sizeof ":max:") - 1; @@ -290,14 +290,15 @@ srv_parse_data_file_paths_and_sizes( (*data_file_names)[i] = path; (*data_file_sizes)[i] = size; - if (0 == memcmp(str, ":autoextend", - (sizeof ":autoextend") - 1)) { + if (0 == strncmp(str, ":autoextend", + (sizeof ":autoextend") - 1)) { *is_auto_extending = TRUE; str += (sizeof ":autoextend") - 1; - if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) { + if (0 == strncmp(str, ":max:", + (sizeof ":max:") - 1)) { str += (sizeof ":max:") - 1; -- cgit v1.2.1 From f6bf85c09e54b8232697c3fa6c85a7d61599bf6b Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 12:25:33 -0700 Subject: Complete application of InnoDB snapshot innodb-5.1-ss2545. Fix race condition which could result in freeing a struct that is still in use by another thread. Detailed revision comments: r2537 | inaam | 2008-07-15 20:46:03 +0300 (Tue, 15 Jul 2008) | 12 lines branches/5.1 issue# 4 Fixed a timing hole where a thread dropping an index can free the in-memory index struct while another thread is still using that structure to remove entries from adaptive hash index belonging to one of the pages that belongs to the index being dropped. The fix is to have a reference counter in the index struct and to wait for this counter to drop to zero beforing freeing the struct. Reviewed by: Heikki r2543 | inaam | 2008-07-22 18:57:43 +0300 (Tue, 22 Jul 2008) | 7 lines branches/5.1: Removed UNIV_INLINE qualifier from btr_search_info_get_ref_count(). Otherwise compilation failed on non-debug builds. Pointed by: Vasil --- storage/innobase/btr/btr0sea.c | 39 +++++++++++++++++++++++++++++++ storage/innobase/dict/dict0dict.c | 47 ++++++++++++++++++++++++++++++++++++++ storage/innobase/include/btr0sea.h | 15 ++++++++++++ 3 files changed, 101 insertions(+) diff --git a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c index 2fe3606a390..3482e16497a 100644 --- a/storage/innobase/btr/btr0sea.c +++ b/storage/innobase/btr/btr0sea.c @@ -161,6 +161,7 @@ btr_search_info_create( info->magic_n = BTR_SEARCH_MAGIC_N; #endif /* UNIV_DEBUG */ + info->ref_count = 0; info->root_guess = NULL; info->hash_analysis = 0; @@ -184,6 +185,31 @@ btr_search_info_create( return(info); } +/********************************************************************* +Returns the value of ref_count. The value is protected by +btr_search_latch. */ +ulint +btr_search_info_get_ref_count( +/*==========================*/ + /* out: ref_count value. */ + btr_search_t* info) /* in: search info. */ +{ + ulint ret; + + ut_ad(info); + +#ifdef UNIV_SYNC_DEBUG + ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); + ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); +#endif /* UNIV_SYNC_DEBUG */ + + rw_lock_s_lock(&btr_search_latch); + ret = info->ref_count; + rw_lock_s_unlock(&btr_search_latch); + + return(ret); +} + /************************************************************************* Updates the search info of an index about hash successes. NOTE that info is NOT protected by any semaphore, to save CPU time! Do not assume its fields @@ -1022,8 +1048,12 @@ next_rec: ha_remove_all_nodes_to_page(table, folds[i], page); } + ut_a(index->search_info->ref_count > 0); + index->search_info->ref_count--; + block->is_hashed = FALSE; block->index = NULL; + cleanup: if (UNIV_UNLIKELY(block->n_pointers)) { /* Corruption */ @@ -1244,6 +1274,15 @@ btr_search_build_page_hash_index( goto exit_func; } + /* This counter is decremented every time we drop page + hash index entries and is incremented here. Since we can + rebuild hash index for a page that is already hashed, we + have to take care not to increment the counter in that + case. */ + if (!block->is_hashed) { + index->search_info->ref_count++; + } + block->is_hashed = TRUE; block->n_hash_helps = 0; diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 5eaa44b4615..7bc700c4268 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -1394,12 +1394,59 @@ dict_index_remove_from_cache( dict_index_t* index) /* in, own: index */ { ulint size; + ulint retries = 0; + btr_search_t* info; ut_ad(table && index); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); ut_ad(mutex_own(&(dict_sys->mutex))); + /* We always create search info whether or not adaptive + hash index is enabled or not. */ + info = index->search_info; + ut_ad(info); + + /* We are not allowed to free the in-memory index struct + dict_index_t until all entries in the adaptive hash index + that point to any of the page belonging to his b-tree index + are dropped. This is so because dropping of these entries + require access to dict_index_t struct. To avoid such scenario + We keep a count of number of such pages in the search_info and + only free the dict_index_t struct when this count drops to + zero. */ + + for (;;) { + ulint ref_count = btr_search_info_get_ref_count(info); + if (ref_count == 0) { + break; + } + + /* Sleep for 10ms before trying again. */ + os_thread_sleep(10000); + ++retries; + + if (retries % 500 == 0) { + /* No luck after 5 seconds of wait. */ + fprintf(stderr, "InnoDB: Error: Waited for" + " %lu secs for hash index" + " ref_count (%lu) to drop" + " to 0.\n" + "index: \"%s\"" + " table: \"%s\"\n", + retries/100, + ref_count, + index->name, + table->name); + } + + /* To avoid a hang here we commit suicide if the + ref_count doesn't drop to zero in 600 seconds. */ + if (retries >= 60000) { + ut_error; + } + } + rw_lock_free(&index->lock); /* Remove the index from the list of indexes of the table */ diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index 281587ad060..6d1c2bb86d3 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -40,6 +40,14 @@ btr_search_info_create( /*===================*/ /* out, own: search info struct */ mem_heap_t* heap); /* in: heap where created */ +/********************************************************************* +Returns the value of ref_count. The value is protected by +btr_search_latch. */ +ulint +btr_search_info_get_ref_count( +/*==========================*/ + /* out: ref_count value. */ + btr_search_t* info); /* in: search info. */ /************************************************************************* Updates the search info. */ UNIV_INLINE @@ -137,6 +145,13 @@ btr_search_validate(void); /* The search info struct in an index */ struct btr_search_struct{ + ulint ref_count; /* Number of blocks in this index tree + that have search index built + i.e. block->index points to this index. + Protected by btr_search_latch except + when during initialization in + btr_search_info_create(). */ + /* The following fields are not protected by any latch. Unfortunately, this means that they must be aligned to the machine word, i.e., they cannot be turned into bit-fields. */ -- cgit v1.2.1 From 2450190eed67992c910615418137046ecfc0e2f4 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 12:28:19 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2637, part 1. Fixes Bug #37885: row_search_for_mysql may gap lock unnecessarily with SQL comments in query Detailed revision comments: r2603 | marko | 2008-08-21 16:25:05 +0300 (Thu, 21 Aug 2008) | 10 lines branches/5.1: Identify SELECT statements by thd_sql_command() == SQLCOM_SELECT instead of parsing the query string. This fixes MySQL Bug #37885 without us having to implement lexical analysis of SQL comments in yet another place. thd_is_select(): A new predicate. row_search_for_mysql(): Use thd_is_select(). Approved by Heikki. --- storage/innobase/handler/ha_innodb.cc | 12 ++++++++++++ storage/innobase/include/ha_prototypes.h | 9 +++++++++ storage/innobase/row/row0sel.c | 17 +++++------------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 4b7c5b1246a..8a8d9698ac1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -507,6 +507,18 @@ thd_has_edited_nontrans_tables( return((ibool) thd_non_transactional_update((THD*) thd)); } +/********************************************************************** +Returns true if the thread is executing a SELECT statement. */ +extern "C" +ibool +thd_is_select( +/*==========*/ + /* out: true if thd is executing SELECT */ + const void* thd) /* in: thread handle (THD*) */ +{ + return(thd_sql_command((const THD*) thd) == SQLCOM_SELECT); +} + /************************************************************************ Obtain the InnoDB transaction of a MySQL thread. */ inline diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index ef0722321af..6bfc43579b3 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -63,5 +63,14 @@ thd_has_edited_nontrans_tables( been edited */ void* thd); /* in: thread handle (THD*) */ +/********************************************************************** +Returns true if the thread is executing a SELECT statement. */ + +ibool +thd_is_select( +/*==========*/ + /* out: true if thd is executing SELECT */ + const void* thd); /* in: thread handle (THD*) */ + #endif #endif diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index c6a93d4e0d5..79f107ce77d 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -32,6 +32,7 @@ Created 12/19/1997 Heikki Tuuri #include "row0mysql.h" #include "read0read.h" #include "buf0lru.h" +#include "ha_prototypes.h" /* Maximum number of rows to prefetch; MySQL interface has another parameter */ #define SEL_MAX_N_PREFETCH 16 @@ -3578,19 +3579,11 @@ shortcut_fails_too_big_rec: if (trx->isolation_level <= TRX_ISO_READ_COMMITTED && prebuilt->select_lock_type != LOCK_NONE && trx->mysql_thd != NULL - && trx->mysql_query_str != NULL - && *trx->mysql_query_str != NULL) { + && thd_is_select(trx->mysql_thd)) { + /* It is a plain locking SELECT and the isolation + level is low: do not lock gaps */ - /* Scan the MySQL query string; check if SELECT is the first - word there */ - - if (dict_str_starts_with_keyword( - trx->mysql_thd, *trx->mysql_query_str, "SELECT")) { - /* It is a plain locking SELECT and the isolation - level is low: do not lock gaps */ - - set_also_gap_locks = FALSE; - } + set_also_gap_locks = FALSE; } /* Note that if the search mode was GE or G, then the cursor -- cgit v1.2.1 From ea912a97c7eb3b8b2c879bccca072287deaab6f0 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 12:29:59 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2637, part 2. Fixes Bug #38839: auto increment does not work properly with InnoDB after update Detailed revision comments: r2609 | sunny | 2008-08-24 01:19:05 +0300 (Sun, 24 Aug 2008) | 12 lines branches/5.1: Fix for MySQL Bug#38839. Reset the statement level last value field in prebuilt. This field tracks the last value in an autoincrement interval. We use this value to check whether we need to update a table's AUTOINC counter, if the value written to a table is less than this value then we avoid updating the table's AUTOINC value in order to reduce mutex contention. If it's not reset (e.g., after a DELETE statement) then there is the possibility of missing updates to the table's AUTOINC counter resulting in a subsequent duplicate row error message under certain conditions (see the test case for details). Bug #38839 - auto increment does not work properly with InnoDB after update --- mysql-test/r/innodb-autoinc.result | 27 +++++++++++++++++++++++++++ mysql-test/t/innodb-autoinc.test | 21 +++++++++++++++++++++ storage/innobase/handler/ha_innodb.cc | 23 +++++++++++++++++------ 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/innodb-autoinc.result b/mysql-test/r/innodb-autoinc.result index e000f910772..70cdc67f77e 100644 --- a/mysql-test/r/innodb-autoinc.result +++ b/mysql-test/r/innodb-autoinc.result @@ -169,3 +169,30 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (NULL,8); +SELECT * FROM t1; +c1 c2 +2 1 +3 8 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1), (NULL, 8); +INSERT INTO t1 VALUES (NULL,9); +SELECT * FROM t1; +c1 c2 +2 1 +3 8 +5 9 +DROP TABLE t1; diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index aa464e42627..1c97364199b 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -139,3 +139,24 @@ SELECT c1 FROM t1; SHOW CREATE TABLE t1; DROP TABLE t1; +# +# Bug 38839 +# Reset the last value generated at end of statement +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1); +INSERT INTO t1 VALUES (NULL,8); +SELECT * FROM t1; +DROP TABLE t1; +# Bug 38839 -- same as above but for multi value insert +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, 1); +DELETE FROM t1 WHERE c1 = 1; +INSERT INTO t1 VALUES (2,1), (NULL, 8); +INSERT INTO t1 VALUES (NULL,9); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 8a8d9698ac1..682ba19aab9 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6429,15 +6429,26 @@ ha_innobase::extra( return(0); } +/********************************************************************** +Reset state of file to after 'open'. +This function is called after every statement for all tables used +by that statement. */ int ha_innobase::reset() { - if (prebuilt->blob_heap) { - row_mysql_prebuilt_free_blob_heap(prebuilt); - } - reset_template(prebuilt); - return 0; -} + if (prebuilt->blob_heap) { + row_mysql_prebuilt_free_blob_heap(prebuilt); + } + reset_template(prebuilt); + + /* TODO: This should really be reset in reset_template() but for now + it's safer to do it explicitly here. */ + + /* This is a statement level counter. */ + prebuilt->last_value = 0; + + return(0); +} /********************************************************************** MySQL calls this function at the start of each SQL statement inside LOCK -- cgit v1.2.1 From bb9ee6b684160b32dd0b35cff86fb3cf22687906 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 12:31:26 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2637, part 3. Fixes Bug #39483: InnoDB hang on adaptive hash because of out of order ::open() call by MySQL Detailed revision comments: r2630 | inaam | 2008-09-16 19:11:26 +0300 (Tue, 16 Sep 2008) | 11 lines branches/5.1 bug#39483 InnoDB hang on adaptive hash because of out of order ::open() call by MySQL Forward port of r2629 Under some conditions MySQL calls ::open with search_latch leading to a deadlock as we try to acquire dict_sys->mutex inside ::open breaking the latching order. The fix is to release search_latch. Reviewed by: Heikki --- storage/innobase/handler/ha_innodb.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 682ba19aab9..1982fe8c212 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2298,6 +2298,14 @@ ha_innobase::open( UT_NOT_USED(test_if_locked); thd = ha_thd(); + + /* Under some cases MySQL seems to call this function while + holding btr_search_latch. This breaks the latching order as + we acquire dict_sys->mutex below and leads to a deadlock. */ + if (thd != NULL) { + innobase_release_temporary_latches(ht, thd); + } + normalize_table_name(norm_name, name); user_thd = NULL; -- cgit v1.2.1 From fae4abd759a623428f08668308fc7b6500fac5c7 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 12:37:23 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 1. Fixes Bug #35498: Cannot get table test/table1 auto-inccounter value in ::info Detailed revison comments: r2702 | sunny | 2008-09-30 11:41:56 +0300 (Tue, 30 Sep 2008) | 13 lines branches/5.1: Since handler::get_auto_increment() doesn't allow us to return the cause of failure we have to inform MySQL using the sql_print_warning() function to return the cause for autoinc failure. Previously we simply printed the error code, this patch prints the text string representing the following two error codes: DB_LOCK_WAIT_TIMEOUT DB_DEADLOCK. Bug#35498 Cannot get table test/table1 auto-inccounter value in ::info Approved by Marko. --- storage/innobase/handler/ha_innodb.cc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 1982fe8c212..600473c2cd2 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7456,13 +7456,23 @@ ha_innobase::innobase_get_auto_increment( } else { *value = autoinc; } - /* A deadlock error during normal processing is OK - and can be ignored. */ - } else if (error != DB_DEADLOCK) { + /* We need to print this message here because the + handler::get_auto_increment() doesn't allow a way + to return the specific error for why it failed. */ + } else if (error == DB_DEADLOCK) { + sql_print_warning( + "Deadlock in " + "innobase_get_auto_increment()"); + } else if (error == DB_LOCK_WAIT_TIMEOUT) { + sql_print_warning( + "Lock wait timeout in " + "innobase_get_auto_increment()"); + } else { - sql_print_error("InnoDB: Error: %lu in " - "::innobase_get_auto_increment()", - error); + sql_print_error( + "InnoDB: Error: %lu in " + "innobase_get_auto_increment()", + error); } } while (*value == 0 && error == DB_SUCCESS); -- cgit v1.2.1 From 19cdcb1f6bad44dfcdf6d664bd8400414a0cc4d3 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:00:37 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 2. Fixes Bug#38231: Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK branches/5.1: Fix Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK In TRUNCATE TABLE and discard tablespace: do not remove table-level S and X locks and do not assert on such locks not being wait locks. Leave such locks alone. Approved by: Heikki (rb://14) --- mysql-test/r/innodb_bug38231.result | 22 +++++ mysql-test/t/innodb_bug38231.test | 166 +++++++++++++++++++++++++++++++++++ storage/innobase/include/lock0lock.h | 17 ++-- storage/innobase/lock/lock0lock.c | 83 ++++++++++++++---- storage/innobase/row/row0mysql.c | 14 ++- 5 files changed, 273 insertions(+), 29 deletions(-) create mode 100644 mysql-test/r/innodb_bug38231.result create mode 100644 mysql-test/t/innodb_bug38231.test diff --git a/mysql-test/r/innodb_bug38231.result b/mysql-test/r/innodb_bug38231.result new file mode 100644 index 00000000000..b5d1d91ddc0 --- /dev/null +++ b/mysql-test/r/innodb_bug38231.result @@ -0,0 +1,22 @@ +SET storage_engine=InnoDB; +INSERT INTO bug38231 VALUES (1), (10), (300); +SET autocommit=0; +SELECT * FROM bug38231 FOR UPDATE; +a +1 +10 +300 +TRUNCATE TABLE bug38231; +COMMIT; +DROP TABLE bug38231; +SET storage_engine=InnoDB; +INSERT INTO bug38231 VALUES (1), (10), (300); +SET autocommit=0; +SELECT * FROM bug38231 FOR UPDATE; +a +1 +10 +300 +TRUNCATE TABLE bug38231; +COMMIT; +DROP TABLE bug38231; diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test new file mode 100644 index 00000000000..7ee35b2bc78 --- /dev/null +++ b/mysql-test/t/innodb_bug38231.test @@ -0,0 +1,166 @@ +# +# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK +# http://bugs.mysql.com/38231 +# + +-- source include/have_innodb.inc + +SET storage_engine=InnoDB; + +# we care only that the following SQL commands do not crash the server +-- disable_query_log +-- disable_result_log + +DROP TABLE IF EXISTS bug38231; +CREATE TABLE bug38231 (a INT); + +-- connect (con1,localhost,root,,) +-- connect (con2,localhost,root,,) +-- connect (con3,localhost,root,,) + +-- connection con1 +SET autocommit=0; +LOCK TABLE bug38231 WRITE; + +-- connection con2 +SET autocommit=0; +-- send +LOCK TABLE bug38231 WRITE; + +-- connection con3 +SET autocommit=0; +-- send +LOCK TABLE bug38231 WRITE; + +-- connection default +-- send +TRUNCATE TABLE bug38231; + +-- connection con1 +# give time to TRUNCATE and others to be executed; without sleep, sometimes +# UNLOCK executes before TRUNCATE +-- sleep 0.2 +# this crashes the server if the bug is present +UNLOCK TABLES; + +# clean up + +-- connection con2 +UNLOCK TABLES; + +-- connection con3 +UNLOCK TABLES; + +-- connection default + +-- disconnect con1 +-- disconnect con2 +-- disconnect con3 + +# test that TRUNCATE works with with row-level locks + +-- enable_query_log +-- enable_result_log + +INSERT INTO bug38231 VALUES (1), (10), (300); + +-- connect (con4,localhost,root,,) + +-- connection con4 +SET autocommit=0; +SELECT * FROM bug38231 FOR UPDATE; + +-- connection default +TRUNCATE TABLE bug38231; + +-- connection con4 +COMMIT; + +-- connection default + +-- disconnect con4 + +DROP TABLE bug38231; +# +# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK +# http://bugs.mysql.com/38231 +# + +-- source include/have_innodb.inc + +SET storage_engine=InnoDB; + +# we care only that the following SQL commands do not crash the server +-- disable_query_log +-- disable_result_log + +DROP TABLE IF EXISTS bug38231; +CREATE TABLE bug38231 (a INT); + +-- connect (con1,localhost,root,,) +-- connect (con2,localhost,root,,) +-- connect (con3,localhost,root,,) + +-- connection con1 +SET autocommit=0; +LOCK TABLE bug38231 WRITE; + +-- connection con2 +SET autocommit=0; +-- send +LOCK TABLE bug38231 WRITE; + +-- connection con3 +SET autocommit=0; +-- send +LOCK TABLE bug38231 WRITE; + +-- connection default +-- send +TRUNCATE TABLE bug38231; + +-- connection con1 +# give time to TRUNCATE and others to be executed; without sleep, sometimes +# UNLOCK executes before TRUNCATE +-- sleep 0.2 +# this crashes the server if the bug is present +UNLOCK TABLES; + +# clean up + +-- connection con2 +UNLOCK TABLES; + +-- connection con3 +UNLOCK TABLES; + +-- connection default + +-- disconnect con1 +-- disconnect con2 +-- disconnect con3 + +# test that TRUNCATE works with with row-level locks + +-- enable_query_log +-- enable_result_log + +INSERT INTO bug38231 VALUES (1), (10), (300); + +-- connect (con4,localhost,root,,) + +-- connection con4 +SET autocommit=0; +SELECT * FROM bug38231 FOR UPDATE; + +-- connection default +TRUNCATE TABLE bug38231; + +-- connection con4 +COMMIT; + +-- connection default + +-- disconnect con4 + +DROP TABLE bug38231; diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 8b08b6284f6..635724bf5a1 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -463,14 +463,21 @@ void lock_cancel_waiting_and_release( /*============================*/ lock_t* lock); /* in: waiting lock request */ + /************************************************************************* -Resets all locks, both table and record locks, on a table to be dropped. -No lock is allowed to be a wait lock. */ +Removes locks on a table to be dropped or truncated. +If remove_also_table_sx_locks is TRUE then table-level S and X locks are +also removed in addition to other table-level and record-level locks. +No lock, that is going to be removed, is allowed to be a wait lock. */ void -lock_reset_all_on_table( -/*====================*/ - dict_table_t* table); /* in: table to be dropped */ +lock_remove_all_on_table( +/*=====================*/ + dict_table_t* table, /* in: table to be dropped + or truncated */ + ibool remove_also_table_sx_locks);/* in: also removes + table S and X locks */ + /************************************************************************* Calculates the fold value of a page file address: used in inserting or searching for a lock in the hash table. */ diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index c2ede22dccb..173d074cb82 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -3920,15 +3920,25 @@ lock_cancel_waiting_and_release( trx_end_lock_wait(lock->trx); } +/* True if a lock mode is S or X */ +#define IS_LOCK_S_OR_X(lock) \ + (lock_get_mode(lock) == LOCK_S \ + || lock_get_mode(lock) == LOCK_X) + + /************************************************************************* -Resets all record and table locks of a transaction on a table to be dropped. -No lock is allowed to be a wait lock. */ +Removes locks of a transaction on a table to be dropped. +If remove_also_table_sx_locks is TRUE then table-level S and X locks are +also removed in addition to other table-level and record-level locks. +No lock, that is going to be removed, is allowed to be a wait lock. */ static void -lock_reset_all_on_table_for_trx( -/*============================*/ - dict_table_t* table, /* in: table to be dropped */ - trx_t* trx) /* in: a transaction */ +lock_remove_all_on_table_for_trx( +/*=============================*/ + dict_table_t* table, /* in: table to be dropped */ + trx_t* trx, /* in: a transaction */ + ibool remove_also_table_sx_locks)/* in: also removes + table S and X locks */ { lock_t* lock; lock_t* prev_lock; @@ -3946,7 +3956,9 @@ lock_reset_all_on_table_for_trx( lock_rec_discard(lock); } else if (lock_get_type(lock) & LOCK_TABLE - && lock->un_member.tab_lock.table == table) { + && lock->un_member.tab_lock.table == table + && (remove_also_table_sx_locks + || !IS_LOCK_S_OR_X(lock))) { ut_a(!lock_get_wait(lock)); @@ -3958,26 +3970,65 @@ lock_reset_all_on_table_for_trx( } /************************************************************************* -Resets all locks, both table and record locks, on a table to be dropped. -No lock is allowed to be a wait lock. */ +Removes locks on a table to be dropped or truncated. +If remove_also_table_sx_locks is TRUE then table-level S and X locks are +also removed in addition to other table-level and record-level locks. +No lock, that is going to be removed, is allowed to be a wait lock. */ void -lock_reset_all_on_table( -/*====================*/ - dict_table_t* table) /* in: table to be dropped */ +lock_remove_all_on_table( +/*=====================*/ + dict_table_t* table, /* in: table to be dropped + or truncated */ + ibool remove_also_table_sx_locks)/* in: also removes + table S and X locks */ { lock_t* lock; + lock_t* prev_lock; mutex_enter(&kernel_mutex); lock = UT_LIST_GET_FIRST(table->locks); - while (lock) { - ut_a(!lock_get_wait(lock)); + while (lock != NULL) { - lock_reset_all_on_table_for_trx(table, lock->trx); + prev_lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, + lock); - lock = UT_LIST_GET_FIRST(table->locks); + /* If we should remove all locks (remove_also_table_sx_locks + is TRUE), or if the lock is not table-level S or X lock, + then check we are not going to remove a wait lock. */ + if (remove_also_table_sx_locks + || !(lock_get_type(lock) == LOCK_TABLE + && IS_LOCK_S_OR_X(lock))) { + + ut_a(!lock_get_wait(lock)); + } + + lock_remove_all_on_table_for_trx(table, lock->trx, + remove_also_table_sx_locks); + + if (prev_lock == NULL) { + if (lock == UT_LIST_GET_FIRST(table->locks)) { + /* lock was not removed, pick its successor */ + lock = UT_LIST_GET_NEXT( + un_member.tab_lock.locks, lock); + } else { + /* lock was removed, pick the first one */ + lock = UT_LIST_GET_FIRST(table->locks); + } + } else if (UT_LIST_GET_NEXT(un_member.tab_lock.locks, + prev_lock) != lock) { + /* If lock was removed by + lock_remove_all_on_table_for_trx() then pick the + successor of prev_lock ... */ + lock = UT_LIST_GET_NEXT( + un_member.tab_lock.locks, prev_lock); + } else { + /* ... otherwise pick the successor of lock. */ + lock = UT_LIST_GET_NEXT( + un_member.tab_lock.locks, lock); + } } mutex_exit(&kernel_mutex); diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index f5228618a04..74bf2267a3e 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -2451,8 +2451,8 @@ row_discard_tablespace_for_mysql( new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID); - /* Remove any locks there are on the table or its records */ - lock_reset_all_on_table(table); + /* Remove all locks except the table-level S and X locks. */ + lock_remove_all_on_table(table, FALSE); info = pars_info_create(); @@ -2787,9 +2787,8 @@ row_truncate_table_for_mysql( goto funct_exit; } - /* Remove any locks there are on the table or its records */ - - lock_reset_all_on_table(table); + /* Remove all locks except the table-level S and X locks. */ + lock_remove_all_on_table(table, FALSE); trx->table_id = table->id; @@ -3139,9 +3138,8 @@ check_next_foreign: goto funct_exit; } - /* Remove any locks there are on the table or its records */ - - lock_reset_all_on_table(table); + /* Remove all locks there are on the table or its records */ + lock_remove_all_on_table(table, TRUE); trx->dict_operation = TRUE; trx->table_id = table->id; -- cgit v1.2.1 From f4d38a034f6531f34b76f3fe97c4187c4f125cac Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:27:13 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 3. branches/5.1: Silence a compilation warning in UNIV_DEBUG. Approved by: Marko (via IM) --- storage/innobase/include/sync0sync.ic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index 908797f9729..ee640abefa6 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -197,7 +197,7 @@ mutex_exit( { ut_ad(mutex_own(mutex)); - ut_d(mutex->thread_id = ULINT_UNDEFINED); + ut_d(mutex->thread_id = (os_thread_id_t) ULINT_UNDEFINED); #ifdef UNIV_SYNC_DEBUG sync_thread_reset_level(mutex); -- cgit v1.2.1 From 19fed02ce9c8635c1451deb0f75ecffaa8593290 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:31:13 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 4. Fixes Bug #39438: Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch Detailed revision comments: r2719 | vasil | 2008-10-03 18:17:28 +0300 (Fri, 03 Oct 2008) | 49 lines branches/5.1: Fix Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch In ha_innobase::info() - do not try to get the free space for a tablespace which has been discarded with ALTER TABLE ... DISCARD TABLESPACE or if the .ibd file is missing for some other reason. ibd_file_missing and tablespace_discarded are manipulated only in row_discard_tablespace_for_mysql() and in row_import_tablespace_for_mysql() and the manipulation is protected/surrounded by row_mysql_lock_data_dictionary()/row_mysql_unlock_data_dictionary() thus we do the same in ha_innobase::info() when checking the values of those members to avoid race conditions. I have tested the code-path with UNIV_DEBUG and UNIV_SYNC_DEBUG. rb://20 Reviewed by: Inaam, Calvin Approved by: Heikki --- mysql-test/lib/mtr_report.pl | 5 ++++- mysql-test/r/innodb_bug39438.result | 1 + mysql-test/t/innodb_bug39438-master.opt | 1 + mysql-test/t/innodb_bug39438.test | 27 +++++++++++++++++++++++++++ storage/innobase/handler/ha_innodb.cc | 21 ++++++++++++++++++--- 5 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 mysql-test/r/innodb_bug39438.result create mode 100644 mysql-test/t/innodb_bug39438-master.opt create mode 100644 mysql-test/t/innodb_bug39438.test diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index 3c78c3ca064..e3fabccd86d 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -412,7 +412,10 @@ sub mtr_report_stats ($) { # When trying to set lower_case_table_names = 2 # on a case sensitive file system. Bug#37402. - /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ + /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or + + # this test is expected to print warnings + ($testname eq 'main.innodb_bug39438') ) { next; # Skip these lines diff --git a/mysql-test/r/innodb_bug39438.result b/mysql-test/r/innodb_bug39438.result new file mode 100644 index 00000000000..195775f74c8 --- /dev/null +++ b/mysql-test/r/innodb_bug39438.result @@ -0,0 +1 @@ +SET storage_engine=InnoDB; diff --git a/mysql-test/t/innodb_bug39438-master.opt b/mysql-test/t/innodb_bug39438-master.opt new file mode 100644 index 00000000000..43fac202fd4 --- /dev/null +++ b/mysql-test/t/innodb_bug39438-master.opt @@ -0,0 +1 @@ +--innodb-file-per-table=1 diff --git a/mysql-test/t/innodb_bug39438.test b/mysql-test/t/innodb_bug39438.test new file mode 100644 index 00000000000..4dc3d957c39 --- /dev/null +++ b/mysql-test/t/innodb_bug39438.test @@ -0,0 +1,27 @@ +# +# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch +# http://bugs.mysql.com/39438 +# +# This test must be run with innodb_file_per_table=1 because the crash +# only occurs if that option is turned on and DISCARD TABLESPACE only +# works with innodb_file_per_table. +# + +-- source include/have_innodb.inc + +SET storage_engine=InnoDB; + +# we care only that the following SQL commands do not crash the server +-- disable_query_log +-- disable_result_log + +DROP TABLE IF EXISTS bug39438; + +CREATE TABLE bug39438 (id INT) ENGINE=INNODB; + +ALTER TABLE bug39438 DISCARD TABLESPACE; + +# this crashes the server if the bug is present +SHOW TABLE STATUS; + +DROP TABLE bug39438; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 600473c2cd2..6e4c3b736af 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5865,9 +5865,24 @@ ha_innobase::info( so the "old" value can remain. delete_length is initialized to 0 in the ha_statistics' constructor. */ if (!(flag & HA_STATUS_NO_LOCK)) { - stats.delete_length = - fsp_get_available_space_in_free_extents( - ib_table->space) * 1024; + + /* lock the data dictionary to avoid races with + ibd_file_missing and tablespace_discarded */ + row_mysql_lock_data_dictionary(prebuilt->trx); + + /* ib_table->space must be an existent tablespace */ + if (!ib_table->ibd_file_missing + && !ib_table->tablespace_discarded) { + + stats.delete_length = + fsp_get_available_space_in_free_extents( + ib_table->space) * 1024; + } else { + + stats.delete_length = 0; + } + + row_mysql_unlock_data_dictionary(prebuilt->trx); } stats.check_time = 0; -- cgit v1.2.1 From c50d60852e57998d99afd8e64540560b736c76b8 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:34:48 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 5. A follow-up to the previous patch, fix for Bug #39438. r2720 | vasil | 2008-10-03 19:52:39 +0300 (Fri, 03 Oct 2008) | 8 lines branches/5.1: Print a warning if an attempt is made to get the free space for a table whose .ibd file is missing or the tablespace has been discarded. This is a followup to r2719. Suggested by: Inaam --- storage/innobase/handler/ha_innodb.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6e4c3b736af..3a571c7fb92 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5879,6 +5879,12 @@ ha_innobase::info( ib_table->space) * 1024; } else { + sql_print_warning( + "Trying to get the free space for " + "table %s but its tablespace has " + "been discarded or the .ibd file " + "is missing. Setting the free space " + "to zero.", ib_table->name); stats.delete_length = 0; } -- cgit v1.2.1 From e366921268ea6a1ef7c6c29bf98ba4ba7f176f09 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:38:14 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 6. Send error message to the client when a rollback occurs when trying to get an autoincrement value. This is related to the fixes for Bug#36411 and Bug#35498. Detailed revision comments: r2721 | sunny | 2008-10-04 02:08:23 +0300 (Sat, 04 Oct 2008) | 6 lines branches/5.1: We need to send the messages to the client because handler::get_auto_increment() doesn't allow a way to return the specific error for why it failed. rb://18 --- storage/innobase/handler/ha_innodb.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 3a571c7fb92..379269ee07f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7477,16 +7477,24 @@ ha_innobase::innobase_get_auto_increment( } else { *value = autoinc; } - /* We need to print this message here because the + /* We need to send the messages to the client because handler::get_auto_increment() doesn't allow a way to return the specific error for why it failed. */ } else if (error == DB_DEADLOCK) { - sql_print_warning( - "Deadlock in " + THD* thd = ha_thd(); + + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_LOCK_DEADLOCK, + "InnoDB: Deadlock in " "innobase_get_auto_increment()"); } else if (error == DB_LOCK_WAIT_TIMEOUT) { - sql_print_warning( - "Lock wait timeout in " + THD* thd = ha_thd(); + + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_LOCK_WAIT_TIMEOUT, + "InnoDB: Lock wait timeout in " "innobase_get_auto_increment()"); } else { @@ -7495,7 +7503,6 @@ ha_innobase::innobase_get_auto_increment( "innobase_get_auto_increment()", error); } - } while (*value == 0 && error == DB_SUCCESS); return(error); -- cgit v1.2.1 From 22f6a8424c74a699a05ae1d83f660df3eec143d0 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:42:37 -0700 Subject: Apply InnoDB snapshot innodb-5.1-2858, part 7. A follow-up fix for Bug 38839, which exposed a pre-existing bug in the autoinc handling. Detailed revision comments: r2722 | sunny | 2008-10-04 02:48:04 +0300 (Sat, 04 Oct 2008) | 18 lines branches/5.1: This bug has always existed but was masked by other errors. The fix for bug# 38839 triggered this bug. When the offset and increment are > 1 we need to calculate the next value taking into consideration the two variables. Previously we simply assumed they were 1 particularly offset was never used. MySQL does its own calculation and that's probably why it seemed to work in the past. We would return what we thought was the correct next value and then MySQL would recalculate the actual value from that and return it to the caller (e.g., handler::write_row()). Several new tests have been added that try and catch some edge cases. The tests exposed a wrap around error in MySQL next value calculation which was filed as bug 39828. The tests will need to be updated once MySQL fix that bug. One good side effect of this fix is that dict_table_t size has been reduced by 8 bytes because we have moved the autoinc_increment field to the row_prebuilt_t structure. See review-board for a detailed discussion. rb://3 --- mysql-test/r/innodb-autoinc.result | 385 ++++++++++++++++++++++++++++++++++ mysql-test/t/innodb-autoinc.test | 213 ++++++++++++++++++- storage/innobase/dict/dict0mem.c | 4 - storage/innobase/handler/ha_innodb.cc | 126 ++++++++--- storage/innobase/include/dict0mem.h | 6 +- storage/innobase/include/row0mysql.h | 11 +- storage/innobase/row/row0mysql.c | 8 +- 7 files changed, 713 insertions(+), 40 deletions(-) diff --git a/mysql-test/r/innodb-autoinc.result b/mysql-test/r/innodb-autoinc.result index 70cdc67f77e..589bf2f30b0 100644 --- a/mysql-test/r/innodb-autoinc.result +++ b/mysql-test/r/innodb-autoinc.result @@ -196,3 +196,388 @@ c1 c2 3 8 5 9 DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(5),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +5 +10 +110 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +c1 +5 +10 +110 +250 +310 +400 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +-1 +1 +2 +10 +110 +250 +410 +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +Got one of the listed errors +SELECT * FROM t1; +c1 +-1 +1 +2 +10 +110 +250 +410 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +c1 +-1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +-2 +-1 +1 +2 +10 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +c1 +-2 +-1 +1 +2 +10 +250 +310 +400 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT INTO t1 VALUES (-2); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (250); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +310 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +310 +400 +1000 +1010 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +SELECT * FROM t1; +c1 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 100 +auto_increment_offset 10 +INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +410 +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +Got one of the listed errors +SELECT * FROM t1; +c1 +1 +2 +10 +110 +210 +250 +410 +1000 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (9223372036854775794); +SELECT * FROM t1; +c1 +1 +9223372036854775794 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 10 +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +SELECT * FROM t1; +c1 +1 +9223372036854775794 +9223372036854775796 +9223372036854775798 +9223372036854775800 +9223372036854775802 +9223372036854775804 +9223372036854775806 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); +SELECT * FROM t1; +c1 +1 +18446744073709551603 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 10 +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +SELECT * FROM t1; +c1 +0 +1 +18446744073709551603 +18446744073709551604 +18446744073709551606 +18446744073709551608 +18446744073709551610 +18446744073709551612 +18446744073709551614 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); +SELECT * FROM t1; +c1 +1 +18446744073709551603 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 5 +auto_increment_offset 7 +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +Got one of the listed errors +SELECT * FROM t1; +c1 +1 +18446744073709551603 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(-9223372036854775806); +INSERT INTO t1 VALUES(-9223372036854775807); +INSERT INTO t1 VALUES(-9223372036854775808); +SELECT * FROM t1; +c1 +-9223372036854775808 +-9223372036854775807 +-9223372036854775806 +1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 3 +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +SELECT * FROM t1; +c1 +-9223372036854775808 +-9223372036854775807 +-9223372036854775806 +1 +3 +6 +9 +DROP TABLE t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 1 +auto_increment_offset 1 +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551610); +SELECT * FROM t1; +c1 +1 +18446744073709551610 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; +Warnings: +Warning 1292 Truncated incorrect auto_increment_increment value: '1152921504606846976' +Warning 1292 Truncated incorrect auto_increment_offset value: '1152921504606846976' +SHOW VARIABLES LIKE "%auto_inc%"; +Variable_name Value +auto_increment_increment 65535 +auto_increment_offset 65535 +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +SELECT * FROM t1; +c1 +1 +65534 +65535 +18446744073709551610 +18446744073709551615 +DROP TABLE t1; diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index 1c97364199b..172913349db 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -156,7 +156,218 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; INSERT INTO t1 VALUES (NULL, 1); DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1), (NULL, 8); +INSERT INTO t1 VALUES (2,1), (NULL, 8); INSERT INTO t1 VALUES (NULL,9); SELECT * FROM t1; DROP TABLE t1; + +# +# Test changes to AUTOINC next value calculation +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL),(5),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Test with SIGNED INT column, by inserting a 0 for the first column value +# 0 is treated in the same was NULL. +# Reset the AUTOINC session variables +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +SET @@INSERT_ID=400; +# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL +-- error ER_DUP_ENTRY,1062 +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Test with SIGNED INT column +# Reset the AUTOINC session variables +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Test with UNSIGNED INT column, single insert +# The sign in the value is ignored and a new column value is generated +# Reset the AUTOINC session variables +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +INSERT INTO t1 VALUES (-2); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES (250); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Test with UNSIGNED INT column, multi-value inserts +# The sign in the value is ignored and a new column value is generated +# Reset the AUTOINC session variables +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(-1); +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); +INSERT INTO t1 VALUES (250),(NULL); +SELECT * FROM t1; +INSERT INTO t1 VALUES (1000); +SET @@INSERT_ID=400; +# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL +-- error ER_DUP_ENTRY,1062 +INSERT INTO t1 VALUES(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Check for overflow handling when increment is > 1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (9223372036854775794); -- 2^63 - 14 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +# This should just fit +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Check for overflow handling when increment and offser are > 1 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); -- 2^64 - 13 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; +SHOW VARIABLES LIKE "%auto_inc%"; +# This should fail because of overflow but it doesn't, it seems to be +# a MySQL server bug. It wraps around to 0 for the last value. +# See MySQL Bug# 39828 +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Check for overflow handling when increment and offset are odd numbers +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551603); -- 2^64 - 13 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; +SHOW VARIABLES LIKE "%auto_inc%"; +# This should fail because of overflow but it doesn't. It fails with +# a duplicate entry message because of a MySQL server bug, it wraps +# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace +# the ER_DUP_ENTRY, 1062 below with the appropriate error message +-- error ER_DUP_ENTRY,1062 +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Check for overflow handling when increment and offset are odd numbers +# and check for large -ve numbers +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES(-9223372036854775806); -- -2^63 + 2 +INSERT INTO t1 VALUES(-9223372036854775807); -- -2^63 + 1 +INSERT INTO t1 VALUES(-9223372036854775808); -- -2^63 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; +SHOW VARIABLES LIKE "%auto_inc%"; +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +SELECT * FROM t1; +DROP TABLE t1; +# +# Check for overflow handling when increment and offset are very +# large numbers 2^60 +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +SET @@INSERT_ID=1; +SHOW VARIABLES LIKE "%auto_inc%"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; +# TODO: Fix the autoinc init code +# We have to do this because of a bug in the AUTOINC init code. +INSERT INTO t1 VALUES(NULL); +INSERT INTO t1 VALUES (18446744073709551610); -- 2^64 - 2 +SELECT * FROM t1; +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; +SHOW VARIABLES LIKE "%auto_inc%"; +# This should fail because of overflow but it doesn't. It wraps around +# and the autoinc values look bogus too. +# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error +# code expected test. +# -- error ER_AUTOINC_READ_FAILED,1467 +INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c index 47cf7a0bc9c..f9935b8db19 100644 --- a/storage/innobase/dict/dict0mem.c +++ b/storage/innobase/dict/dict0mem.c @@ -91,10 +91,6 @@ dict_mem_table_create( table->autoinc_inited = FALSE; - /* The actual increment value will be set by MySQL, we simply - default to 1 here.*/ - table->autoinc_increment = 1; - /* The number of transactions that are either waiting on the AUTOINC lock or have been granted the lock. */ table->n_waiting_or_granted_auto_inc_locks = 0; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 379269ee07f..f79af1e274c 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -921,6 +921,74 @@ innobase_convert_string( errors)); } +/************************************************************************* +Compute the next autoinc value. + +For MySQL replication the autoincrement values can be partitioned among +the nodes. The offset is the start or origin of the autoincrement value +for a particular node. For n nodes the increment will be n and the offset +will be in the interval [1, n]. The formula tries to allocate the next +value for a particular node. + +Note: This function is also called with increment set to the number of +values we want to reserve for multi-value inserts e.g., + + INSERT INTO T VALUES(), (), (); + +innobase_next_autoinc() will be called with increment set to +n * 3 where autoinc_lock_mode != TRADITIONAL because we want +to reserve 3 values for the multi-value INSERT above. */ +static +ulonglong +innobase_next_autoinc( +/*==================*/ + /* out: the next value */ + ulonglong current, /* in: Current value */ + ulonglong increment, /* in: increment current by */ + ulonglong offset) /* in: AUTOINC offset */ +{ + ulonglong next_value; + + /* Should never be 0. */ + ut_a(increment > 0); + + if (offset <= 1) { + /* Offset 0 and 1 are the same, because there must be at + least one node in the system. */ + if (~0x0ULL - current <= increment) { + next_value = ~0x0ULL; + } else { + next_value = current + increment; + } + } else { + if (current > offset) { + next_value = ((current - offset) / increment) + 1; + } else { + next_value = ((offset - current) / increment) + 1; + } + + ut_a(increment > 0); + ut_a(next_value > 0); + + /* Check for multiplication overflow. */ + if (increment > (~0x0ULL / next_value)) { + + next_value = ~0x0ULL; + } else { + next_value *= increment; + + /* Check for overflow. */ + if (~0x0ULL - next_value <= offset) { + next_value = ~0x0ULL; + } else { + next_value += offset; + } + } + } + + return(next_value); +} + /************************************************************************* Gets the InnoDB transaction handle for a MySQL handler object, creates an InnoDB transaction struct if the corresponding MySQL thread struct still @@ -3565,22 +3633,18 @@ no_commit: update the table upper limit. Note: last_value will be 0 if get_auto_increment() was not called.*/ - if (auto_inc > prebuilt->last_value) { + if (auto_inc > prebuilt->autoinc_last_value) { set_max_autoinc: - ut_a(prebuilt->table->autoinc_increment > 0); + ut_a(prebuilt->autoinc_increment > 0); - ulonglong have; ulonglong need; + ulonglong offset; - /* Check for overflow conditions. */ - need = prebuilt->table->autoinc_increment; - have = ~0x0ULL - auto_inc; - - if (have < need) { - need = have; - } + offset = prebuilt->autoinc_offset; + need = prebuilt->autoinc_increment; - auto_inc += need; + auto_inc = innobase_next_autoinc( + auto_inc, need, offset); err = innobase_set_max_autoinc(auto_inc); @@ -3822,7 +3886,15 @@ ha_innobase::update_row( auto_inc = table->next_number_field->val_int(); if (auto_inc != 0) { - auto_inc += prebuilt->table->autoinc_increment; + + ulonglong need; + ulonglong offset; + + offset = prebuilt->autoinc_offset; + need = prebuilt->autoinc_increment; + + auto_inc = innobase_next_autoinc( + auto_inc, need, offset); error = innobase_set_max_autoinc(auto_inc); } @@ -5844,7 +5916,7 @@ ha_innobase::info( not be updated. This will force write_row() into attempting an update of the table's AUTOINC counter. */ - prebuilt->last_value = 0; + prebuilt->autoinc_last_value = 0; } stats.records = (ha_rows)n_rows; @@ -6474,7 +6546,7 @@ int ha_innobase::reset() it's safer to do it explicitly here. */ /* This is a statement level counter. */ - prebuilt->last_value = 0; + prebuilt->autoinc_last_value = 0; return(0); } @@ -7568,7 +7640,7 @@ ha_innobase::get_auto_increment( set_if_bigger(*first_value, autoinc); /* Not in the middle of a mult-row INSERT. */ - } else if (prebuilt->last_value == 0) { + } else if (prebuilt->autoinc_last_value == 0) { set_if_bigger(*first_value, autoinc); } @@ -7577,35 +7649,33 @@ ha_innobase::get_auto_increment( /* With old style AUTOINC locking we only update the table's AUTOINC counter after attempting to insert the row. */ if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) { - ulonglong have; ulonglong need; + ulonglong next_value; - /* Check for overflow conditions. */ need = *nb_reserved_values * increment; - have = ~0x0ULL - *first_value; - - if (have < need) { - need = have; - } /* Compute the last value in the interval */ - prebuilt->last_value = *first_value + need; + next_value = innobase_next_autoinc(*first_value, need, offset); + + prebuilt->autoinc_last_value = next_value; - ut_a(prebuilt->last_value >= *first_value); + ut_a(prebuilt->autoinc_last_value >= *first_value); /* Update the table autoinc variable */ dict_table_autoinc_update( - prebuilt->table, prebuilt->last_value); + prebuilt->table, prebuilt->autoinc_last_value); } else { /* This will force write_row() into attempting an update of the table's AUTOINC counter. */ - prebuilt->last_value = 0; + prebuilt->autoinc_last_value = 0; } /* The increment to be used to increase the AUTOINC value, we use this in write_row() and update_row() to increase the autoinc counter - for columns that are filled by the user.*/ - prebuilt->table->autoinc_increment = increment; + for columns that are filled by the user. We need the offset and + the increment. */ + prebuilt->autoinc_offset = offset; + prebuilt->autoinc_increment = increment; dict_table_autoinc_unlock(prebuilt->table); } diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 2fe72498989..6e5435493cb 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -411,11 +411,6 @@ struct dict_table_struct{ SELECT MAX(auto inc column) */ ib_ulonglong autoinc;/* autoinc counter value to give to the next inserted row */ - - ib_longlong autoinc_increment; - /* The increment step of the auto increment - column. Value must be greater than or equal - to 1 */ ulong n_waiting_or_granted_auto_inc_locks; /* This counter is used to track the number of granted and pending autoinc locks on this @@ -425,6 +420,7 @@ struct dict_table_struct{ acquired the AUTOINC lock or not. Of course only one transaction can be granted the lock but there can be multiple waiters. */ + /*----------------------*/ #ifdef UNIV_DEBUG ulint magic_n;/* magic number */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index ca9d9c6b8f8..dd6b1d00676 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -683,7 +683,16 @@ struct row_prebuilt_struct { to this heap */ mem_heap_t* old_vers_heap; /* memory heap where a previous version is built in consistent read */ - ulonglong last_value; /* last value of AUTO-INC interval */ + /*----------------------*/ + ulonglong autoinc_last_value;/* last value of AUTO-INC interval */ + ulonglong autoinc_increment;/* The increment step of the auto + increment column. Value must be + greater than or equal to 1. Required to + calculate the next value */ + ulonglong autoinc_offset; /* The offset passed to + get_auto_increment() by MySQL. Required + to calculate the next value */ + /*----------------------*/ ulint magic_n2; /* this should be the same as magic_n */ }; diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 74bf2267a3e..a3e2549f517 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -661,7 +661,13 @@ row_create_prebuilt( prebuilt->old_vers_heap = NULL; - prebuilt->last_value = 0; + prebuilt->autoinc_offset = 0; + + /* Default to 1, we will set the actual value later in + ha_innobase::get_auto_increment(). */ + prebuilt->autoinc_increment = 1; + + prebuilt->autoinc_last_value = 0; return(prebuilt); } -- cgit v1.2.1 From 915635bbbe2f3195c0347c49c23e82c213c036c6 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:47:17 -0700 Subject: Apply InnoDB snapshot innodb-5.1-2858, part 8. Fixes Bug #39939: DROP TABLE/DISCARD TABLESPACE takes long time in buf_LRU_invalidate_tablespace() Detailed revision comments: r2742 | inaam | 2008-10-08 22:02:15 +0300 (Wed, 08 Oct 2008) | 11 lines branches/5.1: Improve implementation of buf_LRU_invalidate_tablespace by attempting hash index drop in batches instead of doing it one by one. Reviewed by: Heikki, Sunny, Marko Approved by: Heikki --- storage/innobase/buf/buf0lru.c | 127 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c index f3913ed49b7..d3c787d1578 100644 --- a/storage/innobase/buf/buf0lru.c +++ b/storage/innobase/buf/buf0lru.c @@ -42,6 +42,11 @@ initial segment in buf_LRU_get_recent_limit */ #define BUF_LRU_INITIAL_RATIO 8 +/* When dropping the search hash index entries before deleting an ibd +file, we build a local array of pages belonging to that tablespace +in the buffer pool. Following is the size of that array. */ +#define BUF_LRU_DROP_SEARCH_HASH_SIZE 1024 + /* If we switch on the InnoDB monitor because there are too few available frames in the buffer pool, we set this to TRUE */ ibool buf_lru_switched_on_innodb_mon = FALSE; @@ -65,6 +70,120 @@ buf_LRU_block_free_hashed_page( buf_block_t* block); /* in: block, must contain a file page and be in a state where it can be freed */ +/********************************************************************** +Attempts to drop page hash index on a batch of pages belonging to a +particular space id. */ +static +void +buf_LRU_drop_page_hash_batch( +/*=========================*/ + ulint id, /* in: space id */ + const ulint* arr, /* in: array of page_no */ + ulint count) /* in: number of entries in array */ +{ + ulint i; + + ut_ad(arr != NULL); + ut_ad(count <= BUF_LRU_DROP_SEARCH_HASH_SIZE); + + for (i = 0; i < count; ++i) { + btr_search_drop_page_hash_when_freed(id, arr[i]); + } +} + +/********************************************************************** +When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page +hash index entries belonging to that table. This function tries to +do that in batch. Note that this is a 'best effort' attempt and does +not guarantee that ALL hash entries will be removed. */ +static +void +buf_LRU_drop_page_hash_for_tablespace( +/*==================================*/ + ulint id) /* in: space id */ +{ + buf_block_t* block; + ulint* page_arr; + ulint num_entries; + + page_arr = ut_malloc(sizeof(ulint) + * BUF_LRU_DROP_SEARCH_HASH_SIZE); + mutex_enter(&buf_pool->mutex); + +scan_again: + num_entries = 0; + block = UT_LIST_GET_LAST(buf_pool->LRU); + + while (block != NULL) { + buf_block_t* prev_block; + + mutex_enter(&block->mutex); + prev_block = UT_LIST_GET_PREV(LRU, block); + + ut_a(block->state == BUF_BLOCK_FILE_PAGE); + + if (block->space != id + || block->buf_fix_count > 0 + || block->io_fix != 0) { + /* We leave the fixed pages as is in this scan. + To be dealt with later in the final scan. */ + mutex_exit(&block->mutex); + goto next_page; + } + + ut_ad(block->space == id); + if (block->is_hashed) { + + /* Store the offset(i.e.: page_no) in the array + so that we can drop hash index in a batch + later. */ + page_arr[num_entries] = block->offset; + mutex_exit(&block->mutex); + ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE); + ++num_entries; + + if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) { + goto next_page; + } + /* Array full. We release the buf_pool->mutex to + obey the latching order. */ + mutex_exit(&buf_pool->mutex); + + buf_LRU_drop_page_hash_batch(id, page_arr, + num_entries); + num_entries = 0; + mutex_enter(&buf_pool->mutex); + } else { + mutex_exit(&block->mutex); + } + +next_page: + /* Note that we may have released the buf_pool->mutex + above after reading the prev_block during processing + of a page_hash_batch (i.e.: when the array was full). + This means that prev_block can change in LRU list. + This is OK because this function is a 'best effort' + to drop as many search hash entries as possible and + it does not guarantee that ALL such entries will be + dropped. */ + block = prev_block; + + /* If, however, block has been removed from LRU list + to the free list then we should restart the scan. + block->state is protected by buf_pool->mutex. */ + if (block && block->state != BUF_BLOCK_FILE_PAGE) { + ut_a(num_entries == 0); + goto scan_again; + } + } + + mutex_exit(&buf_pool->mutex); + + /* Drop any remaining batch of search hashed pages. */ + buf_LRU_drop_page_hash_batch(id, page_arr, num_entries); + ut_free(page_arr); +} + /********************************************************************** Invalidates all pages belonging to a given tablespace when we are deleting the data file(s) of that tablespace. */ @@ -78,6 +197,14 @@ buf_LRU_invalidate_tablespace( ulint page_no; ibool all_freed; + /* Before we attempt to drop pages one by one we first + attempt to drop page hash index entries in batches to make + it more efficient. The batching attempt is a best effort + attempt and does not guarantee that all pages hash entries + will be dropped. We get rid of remaining page hash entries + one by one below. */ + buf_LRU_drop_page_hash_for_tablespace(id); + scan_again: mutex_enter(&(buf_pool->mutex)); -- cgit v1.2.1 From 9f8f9715d3d994a6f3f83eabb7d8347054e81203 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:48:44 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 9. Improve a comment. Detailed revision comments: r2744 | marko | 2008-10-09 10:53:09 +0300 (Thu, 09 Oct 2008) | 5 lines branches/5.1: ha_innobase::delete_all_rows(): In response to a user asking why DELETE FROM t is not mapped to TRUNCATE TABLE t as it is in MyISAM, note in a comment that DELETE is transactional while TRUNCATE is not. --- storage/innobase/handler/ha_innodb.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f79af1e274c..7a3f245de3e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5335,7 +5335,8 @@ ha_innobase::delete_all_rows(void) if (thd_sql_command(user_thd) != SQLCOM_TRUNCATE) { fallback: /* We only handle TRUNCATE TABLE t as a special case. - DELETE FROM t will have to use ha_innobase::delete_row(). */ + DELETE FROM t will have to use ha_innobase::delete_row(), + because DELETE is transactional while TRUNCATE is not. */ DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND); } -- cgit v1.2.1 From 7cd7760d2f555df19414c59dde0b38559a37230d Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:50:41 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 10. Fix memory handling to avoid possible crash during error printout. (Code review, no associated bug.) Detailed revision comments: r2782 | marko | 2008-10-13 14:21:02 +0300 (Mon, 13 Oct 2008) | 5 lines branches/5.1: Backport a fix from branches/zip r2763: row_drop_database_for_mysql(): Postpone mem_free(table_name), so that an error printout will not dereference freed memory. --- storage/innobase/row/row0mysql.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index a3e2549f517..c3183d05e3f 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -3441,8 +3441,6 @@ loop: err = row_drop_table_for_mysql(table_name, trx, TRUE); - mem_free(table_name); - if (err != DB_SUCCESS) { fputs("InnoDB: DROP DATABASE ", stderr); ut_print_name(stderr, trx, TRUE, name); @@ -3450,8 +3448,11 @@ loop: (ulint) err); ut_print_name(stderr, trx, TRUE, table_name); putc('\n', stderr); + mem_free(table_name); break; } + + mem_free(table_name); } if (err == DB_SUCCESS) { -- cgit v1.2.1 From 3692ae364e9f0b4086d41da454fea6c38c79c9ac Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:52:05 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 11. White space changes. Detailed revision comments: r2826 | vasil | 2008-10-20 14:09:01 +0300 (Mon, 20 Oct 2008) | 5 lines branches/5.1: Non-functional change: use a single tab instead of 12 spaces between variable type and variable name. --- storage/innobase/handler/ha_innodb.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7a3f245de3e..b573e5ba79b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7554,7 +7554,7 @@ ha_innobase::innobase_get_auto_increment( handler::get_auto_increment() doesn't allow a way to return the specific error for why it failed. */ } else if (error == DB_DEADLOCK) { - THD* thd = ha_thd(); + THD* thd = ha_thd(); push_warning( thd, MYSQL_ERROR::WARN_LEVEL_ERROR, @@ -7562,7 +7562,7 @@ ha_innobase::innobase_get_auto_increment( "InnoDB: Deadlock in " "innobase_get_auto_increment()"); } else if (error == DB_LOCK_WAIT_TIMEOUT) { - THD* thd = ha_thd(); + THD* thd = ha_thd(); push_warning( thd, MYSQL_ERROR::WARN_LEVEL_ERROR, -- cgit v1.2.1 From 3d2d2d0c17b6a67c9fb3a82856a7d88c27462bee Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:52:47 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 12. A follow-up to fix for bug #39438. This moves some errro messages from the server error log to the client, to make it easier for users (especially in shared hosting environment) to get info about why their statement is failing. Detailed revision comments: r2832 | vasil | 2008-10-21 10:08:30 +0300 (Tue, 21 Oct 2008) | 10 lines branches/5.1: In ha_innobase::info(): Replace sql_print_warning() which prints to mysqld error log with push_warning_printf() which sends the error message to the client. Suggested by: Marko, Sunny, Michael Objected by: Inaam --- storage/innobase/handler/ha_innodb.cc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b573e5ba79b..c91ccf36863 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5952,12 +5952,21 @@ ha_innobase::info( ib_table->space) * 1024; } else { - sql_print_warning( - "Trying to get the free space for " - "table %s but its tablespace has " - "been discarded or the .ibd file " - "is missing. Setting the free space " - "to zero.", ib_table->name); + THD* thd; + + thd = ha_thd(); + + push_warning_printf( + thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_CANT_GET_STAT, + "InnoDB: Trying to get the free " + "space for table %s but its " + "tablespace has been discarded or " + "the .ibd file is missing. Setting " + "the free space to zero.", + ib_table->name); + stats.delete_length = 0; } -- cgit v1.2.1 From a32e048645cb2bf3435f8f95eb36958aeaba0f3a Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:56:33 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 13. Fixes Bug #40224: New AUTOINC changes mask reporting of deadlock/timeout errors Detailed revision comments: r2849 | sunny | 2008-10-22 12:01:18 +0300 (Wed, 22 Oct 2008) | 8 lines branches/5.1: Return the actual error code encountered when allocating a new autoinc value. The change in behavior (bug) was introduced in 5.1.22 when we introduced the new AUTOINC locking model. rb://31 --- storage/innobase/handler/ha_innodb.cc | 93 ++++++++++++----------------------- storage/innobase/include/row0mysql.h | 5 ++ storage/innobase/row/row0mysql.c | 1 + 3 files changed, 38 insertions(+), 61 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c91ccf36863..195ec799ce9 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3561,8 +3561,20 @@ no_commit: /* This is the case where the table has an auto-increment column */ if (table->next_number_field && record == table->record[0]) { + /* Reset the error code before calling + innobase_get_auto_increment(). */ + prebuilt->autoinc_error = DB_SUCCESS; + if ((error = update_auto_increment())) { + /* We don't want to mask autoinc overflow errors. */ + if (prebuilt->autoinc_error != DB_SUCCESS) { + error = prebuilt->autoinc_error; + + goto report_error; + } + + /* MySQL errors are passed straight back. */ goto func_exit; } @@ -3658,6 +3670,7 @@ set_max_autoinc: innodb_srv_conc_exit_innodb(prebuilt->trx); +report_error: error = convert_error_code_to_mysql(error, user_thd); func_exit: @@ -6056,25 +6069,12 @@ ha_innobase::info( if (flag & HA_STATUS_AUTO && table->found_next_number_field) { ulonglong auto_inc; - int ret; - - /* The following function call can the first time fail in - a lock wait timeout error because it reserves the auto-inc - lock on the table. If it fails, then someone is already initing - the auto-inc counter, and the second call is guaranteed to - succeed. */ - - ret = innobase_read_and_init_auto_inc(&auto_inc); - if (ret != 0) { - ret = innobase_read_and_init_auto_inc(&auto_inc); - - if (ret != 0) { - sql_print_error("Cannot get table %s auto-inc" - "counter value in ::info\n", - ib_table->name); - auto_inc = 0; - } + if (innobase_read_and_init_auto_inc(&auto_inc) != 0) { + sql_print_error("Cannot get table %s auto-inc" + "counter value in ::info\n", + ib_table->name); + auto_inc = 0; } stats.auto_increment_value = auto_inc; @@ -7459,7 +7459,6 @@ ha_innobase::innobase_read_and_init_auto_inc( if (auto_inc == 0) { dict_index_t* index; - ulint error; const char* autoinc_col_name; ut_a(!innodb_table->autoinc_inited); @@ -7468,10 +7467,10 @@ ha_innobase::innobase_read_and_init_auto_inc( autoinc_col_name = table->found_next_number_field->field_name; - error = row_search_max_autoinc( + prebuilt->autoinc_error = row_search_max_autoinc( index, autoinc_col_name, &auto_inc); - if (error == DB_SUCCESS) { + if (prebuilt->autoinc_error == DB_SUCCESS) { if (auto_inc < ~0x0ULL) { ++auto_inc; } @@ -7480,7 +7479,7 @@ ha_innobase::innobase_read_and_init_auto_inc( ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Error: (%lu) Couldn't read " "the max AUTOINC value from the index (%s).\n", - error, index->name); + prebuilt->autoinc_error, index->name); mysql_error = 1; } @@ -7511,22 +7510,23 @@ ha_innobase::innobase_read_and_init_auto_inc( Read the next autoinc value, initialize the table if it's not initialized. On return if there is no error then the tables AUTOINC lock is locked.*/ -ulong +ulint ha_innobase::innobase_get_auto_increment( /*=====================================*/ ulonglong* value) /* out: autoinc value */ { - ulong error; - *value = 0; /* Note: If the table is not initialized when we attempt the read below. We initialize the table's auto-inc counter and always do a reread of the AUTOINC value. */ do { - error = innobase_autoinc_lock(); + /* We need to send the correct error code to the client + because handler::get_auto_increment() doesn't allow a way + to return the specific error for why it failed. */ + prebuilt->autoinc_error = innobase_autoinc_lock(); - if (error == DB_SUCCESS) { + if (prebuilt->autoinc_error == DB_SUCCESS) { ulonglong autoinc; /* Determine the first value of the interval */ @@ -7548,46 +7548,17 @@ ha_innobase::innobase_get_auto_increment( /* Just to make sure */ ut_a(!trx->auto_inc_lock); - int mysql_error; - - mysql_error = innobase_read_and_init_auto_inc( - &autoinc); + /* Will set prebuilt->autoinc_error if there + is a problem during init. */ + innobase_read_and_init_auto_inc(&autoinc); - if (mysql_error) { - error = DB_ERROR; - } } else { *value = autoinc; } - /* We need to send the messages to the client because - handler::get_auto_increment() doesn't allow a way - to return the specific error for why it failed. */ - } else if (error == DB_DEADLOCK) { - THD* thd = ha_thd(); - - push_warning( - thd, MYSQL_ERROR::WARN_LEVEL_ERROR, - ER_LOCK_DEADLOCK, - "InnoDB: Deadlock in " - "innobase_get_auto_increment()"); - } else if (error == DB_LOCK_WAIT_TIMEOUT) { - THD* thd = ha_thd(); - - push_warning( - thd, MYSQL_ERROR::WARN_LEVEL_ERROR, - ER_LOCK_WAIT_TIMEOUT, - "InnoDB: Lock wait timeout in " - "innobase_get_auto_increment()"); - } else { - - sql_print_error( - "InnoDB: Error: %lu in " - "innobase_get_auto_increment()", - error); } - } while (*value == 0 && error == DB_SUCCESS); + } while (*value == 0 && prebuilt->autoinc_error == DB_SUCCESS); - return(error); + return(prebuilt->autoinc_error); } /******************************************************************************* diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index dd6b1d00676..9c3ba558d3c 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -692,6 +692,11 @@ struct row_prebuilt_struct { ulonglong autoinc_offset; /* The offset passed to get_auto_increment() by MySQL. Required to calculate the next value */ + ulint autoinc_error; /* The actual error code encountered + while trying to init or read the + autoinc value from the table. We + store it here so that we can return + it to MySQL */ /*----------------------*/ ulint magic_n2; /* this should be the same as magic_n */ diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index c3183d05e3f..2d1cf22e4e7 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -661,6 +661,7 @@ row_create_prebuilt( prebuilt->old_vers_heap = NULL; + prebuilt->autoinc_error = 0; prebuilt->autoinc_offset = 0; /* Default to 1, we will set the actual value later in -- cgit v1.2.1 From 5e421fb8fe54b51979761b49416cc463b4eaf652 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:57:54 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 14. Fixes Bug #37788: InnoDB Plugin: AUTO_INCREMENT wrong for compressed tables (Note, this bug is not only in the plugin, the overflow checks are relevant for MySQL's InnoDB as well.) Detailed revision comments: r2852 | sunny | 2008-10-23 01:42:24 +0300 (Thu, 23 Oct 2008) | 9 lines branches/5.1: Backport r2724 from branches/zip Check column value against the col max value before updating the table's global autoinc counter value. This is part of simplifying the AUTOINC sub-system. We extract the type info from MySQL data structures at runtime. --- storage/innobase/handler/ha_innodb.cc | 100 +++++++++++++++++++++++++++++----- storage/innobase/handler/ha_innodb.h | 1 + 2 files changed, 88 insertions(+), 13 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 195ec799ce9..ab4d4e96cef 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -945,7 +945,8 @@ innobase_next_autoinc( /* out: the next value */ ulonglong current, /* in: Current value */ ulonglong increment, /* in: increment current by */ - ulonglong offset) /* in: AUTOINC offset */ + ulonglong offset, /* in: AUTOINC offset */ + ulonglong max_value) /* in: max value for type */ { ulonglong next_value; @@ -955,8 +956,8 @@ innobase_next_autoinc( if (offset <= 1) { /* Offset 0 and 1 are the same, because there must be at least one node in the system. */ - if (~0x0ULL - current <= increment) { - next_value = ~0x0ULL; + if (max_value - current <= increment) { + next_value = max_value; } else { next_value = current + increment; } @@ -971,15 +972,15 @@ innobase_next_autoinc( ut_a(next_value > 0); /* Check for multiplication overflow. */ - if (increment > (~0x0ULL / next_value)) { + if (increment > (max_value / next_value)) { - next_value = ~0x0ULL; + next_value = max_value; } else { next_value *= increment; /* Check for overflow. */ - if (~0x0ULL - next_value <= offset) { - next_value = ~0x0ULL; + if (max_value - next_value <= offset) { + next_value = max_value; } else { next_value += offset; } @@ -3339,6 +3340,59 @@ skip_field: } } +/************************************************************************ +Get the upper limit of the MySQL integral type. */ + +ulonglong +ha_innobase::innobase_get_int_col_max_value( +/*========================================*/ + const Field* field) +{ + ulonglong max_value = 0; + + switch(field->key_type()) { + /* TINY */ + case HA_KEYTYPE_BINARY: + max_value = 0xFFULL; + break; + case HA_KEYTYPE_INT8: + max_value = 0x7FULL; + break; + /* SHORT */ + case HA_KEYTYPE_USHORT_INT: + max_value = 0xFFFFULL; + break; + case HA_KEYTYPE_SHORT_INT: + max_value = 0x7FFFULL; + break; + /* MEDIUM */ + case HA_KEYTYPE_UINT24: + max_value = 0xFFFFFFULL; + break; + case HA_KEYTYPE_INT24: + max_value = 0x7FFFFFULL; + break; + /* LONG */ + case HA_KEYTYPE_ULONG_INT: + max_value = 0xFFFFFFFFULL; + break; + case HA_KEYTYPE_LONG_INT: + max_value = 0x7FFFFFFFULL; + break; + /* BIG */ + case HA_KEYTYPE_ULONGLONG: + max_value = 0xFFFFFFFFFFFFFFFFULL; + break; + case HA_KEYTYPE_LONGLONG: + max_value = 0x7FFFFFFFFFFFFFFFULL; + break; + default: + ut_error; + } + + return(max_value); +} + /************************************************************************ This special handling is really to overcome the limitations of MySQL's binlogging. We need to eliminate the non-determinism that will arise in @@ -3598,6 +3652,7 @@ no_commit: if (auto_inc_used) { ulint err; ulonglong auto_inc; + ulonglong col_max_value; /* Note the number of rows processed for this statement, used by get_auto_increment() to determine the number of AUTO-INC @@ -3607,6 +3662,11 @@ no_commit: --trx->n_autoinc_rows; } + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + col_max_value = innobase_get_int_col_max_value( + table->next_number_field); + /* Get the value that MySQL attempted to store in the table.*/ auto_inc = table->next_number_field->val_int(); @@ -3645,7 +3705,8 @@ no_commit: update the table upper limit. Note: last_value will be 0 if get_auto_increment() was not called.*/ - if (auto_inc > prebuilt->autoinc_last_value) { + if (auto_inc < col_max_value + && auto_inc > prebuilt->autoinc_last_value) { set_max_autoinc: ut_a(prebuilt->autoinc_increment > 0); @@ -3656,7 +3717,7 @@ set_max_autoinc: need = prebuilt->autoinc_increment; auto_inc = innobase_next_autoinc( - auto_inc, need, offset); + auto_inc, need, offset, col_max_value); err = innobase_set_max_autoinc(auto_inc); @@ -3894,11 +3955,17 @@ ha_innobase::update_row( && (trx->duplicates & (TRX_DUP_IGNORE | TRX_DUP_REPLACE)) == TRX_DUP_IGNORE) { - longlong auto_inc; + ulonglong auto_inc; + ulonglong col_max_value; auto_inc = table->next_number_field->val_int(); - if (auto_inc != 0) { + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + col_max_value = innobase_get_int_col_max_value( + table->next_number_field); + + if (auto_inc < col_max_value && auto_inc != 0) { ulonglong need; ulonglong offset; @@ -3907,7 +3974,7 @@ ha_innobase::update_row( need = prebuilt->autoinc_increment; auto_inc = innobase_next_autoinc( - auto_inc, need, offset); + auto_inc, need, offset, col_max_value); error = innobase_set_max_autoinc(auto_inc); } @@ -7632,11 +7699,18 @@ ha_innobase::get_auto_increment( if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) { ulonglong need; ulonglong next_value; + ulonglong col_max_value; + + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + col_max_value = innobase_get_int_col_max_value( + table->next_number_field); need = *nb_reserved_values * increment; /* Compute the last value in the interval */ - next_value = innobase_next_autoinc(*first_value, need, offset); + next_value = innobase_next_autoinc( + *first_value, need, offset, col_max_value); prebuilt->autoinc_last_value = next_value; diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 4ffcdb1e3c2..95890e2215d 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -78,6 +78,7 @@ class ha_innobase: public handler ulong innobase_reset_autoinc(ulonglong auto_inc); ulong innobase_get_auto_increment(ulonglong* value); dict_index_t* innobase_get_index(uint keynr); + ulonglong innobase_get_int_col_max_value(const Field* field); /* Init values for the class: */ public: -- cgit v1.2.1 From d29aaf893c1290f60807c3e77646bbb1c9db5ee0 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 13:59:50 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 15. Fixes Bug #39830: Table autoinc value not updated on first insert. Bug #35498: Cannot get table test/table1 auto-inccounter value in ::info Bug #36411: Failed to read auto-increment value from storage engine" in 5.1.24 auto-inc Detailed revision comments: r2854 | sunny | 2008-10-23 08:30:32 +0300 (Thu, 23 Oct 2008) | 13 lines branches/5.1: Backport changes from branches/zip r2725 Simplify the autoinc initialization code. This removes the non-determinism related to reading the table's autoinc value for the first time. This change has also reduced the sizeof dict_table_t by sizeof(ibool) bytes because we don't need the dict_table_t::autoinc_inited field anymore. rb://16 --- storage/innobase/dict/dict0dict.c | 25 +-- storage/innobase/dict/dict0mem.c | 2 +- storage/innobase/handler/ha_innodb.cc | 295 +++++++++++++--------------------- storage/innobase/handler/ha_innodb.h | 10 +- storage/innobase/include/dict0dict.h | 11 +- storage/innobase/include/dict0mem.h | 4 - storage/innobase/row/row0mysql.c | 2 +- 7 files changed, 137 insertions(+), 212 deletions(-) diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 7bc700c4268..c7a57d6a2b8 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -422,8 +422,7 @@ dict_table_autoinc_lock( } /************************************************************************ -Initializes the autoinc counter. It is not an error to initialize an already -initialized counter. */ +Unconditionally set the autoinc counter. */ void dict_table_autoinc_initialize( @@ -433,7 +432,6 @@ dict_table_autoinc_initialize( { ut_ad(mutex_own(&table->autoinc_mutex)); - table->autoinc_inited = TRUE; table->autoinc = value; } @@ -447,32 +445,25 @@ dict_table_autoinc_read( /* out: value for a new row, or 0 */ dict_table_t* table) /* in: table */ { - ib_longlong value; - ut_ad(mutex_own(&table->autoinc_mutex)); - if (!table->autoinc_inited) { - - value = 0; - } else { - value = table->autoinc; - } - - return(value); + return(table->autoinc); } /************************************************************************ Updates the autoinc counter if the value supplied is greater than the -current value. If not inited, does nothing. */ +current value. */ void -dict_table_autoinc_update( -/*======================*/ +dict_table_autoinc_update_if_greater( +/*=================================*/ dict_table_t* table, /* in: table */ ib_ulonglong value) /* in: value which was assigned to a row */ { - if (table->autoinc_inited && value > table->autoinc) { + ut_ad(mutex_own(&table->autoinc_mutex)); + + if (value > table->autoinc) { table->autoinc = value; } diff --git a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c index f9935b8db19..168771ca307 100644 --- a/storage/innobase/dict/dict0mem.c +++ b/storage/innobase/dict/dict0mem.c @@ -89,7 +89,7 @@ dict_mem_table_create( mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX); - table->autoinc_inited = FALSE; + table->autoinc = 0; /* The number of transactions that are either waiting on the AUTOINC lock or have been granted the lock. */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ab4d4e96cef..bf777b982db 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -953,7 +953,9 @@ innobase_next_autoinc( /* Should never be 0. */ ut_a(increment > 0); - if (offset <= 1) { + if (max_value <= current) { + next_value = max_value; + } else if (offset <= 1) { /* Offset 0 and 1 are the same, because there must be at least one node in the system. */ if (max_value - current <= increment) { @@ -978,6 +980,8 @@ innobase_next_autoinc( } else { next_value *= increment; + ut_a(max_value >= next_value); + /* Check for overflow. */ if (max_value - next_value <= offset) { next_value = max_value; @@ -987,6 +991,8 @@ innobase_next_autoinc( } } + ut_a(next_value <= max_value); + return(next_value); } @@ -2343,6 +2349,44 @@ normalize_table_name( #endif } +/************************************************************************ +Set the autoinc column max value. This should only be called once from +ha_innobase::open(). Therefore there's no need for a covering lock. */ + +ulong +ha_innobase::innobase_initialize_autoinc() +/*======================================*/ +{ + dict_index_t* index; + ulonglong auto_inc; + const char* col_name; + ulint error = DB_SUCCESS; + dict_table_t* innodb_table = prebuilt->table; + + col_name = table->found_next_number_field->field_name; + index = innobase_get_index(table->s->next_number_index); + + /* Execute SELECT MAX(col_name) FROM TABLE; */ + error = row_search_max_autoinc(index, col_name, &auto_inc); + + if (error == DB_SUCCESS) { + + /* At the this stage we dont' know the increment + or the offset, so use default inrement of 1. */ + ++auto_inc; + + dict_table_autoinc_initialize(innodb_table, auto_inc); + + } else { + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Error: (%lu) Couldn't read " + "the MAX(%s) autoinc value from the " + "index (%s).\n", error, col_name, index->name); + } + + return(ulong(error)); +} + /********************************************************************* Creates and opens a handle to a table which already exists in an InnoDB database. */ @@ -2534,6 +2578,26 @@ retry: info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + /* Only if the table has an AUTOINC column. */ + if (prebuilt->table != NULL && table->found_next_number_field != NULL) { + ulint error; + + dict_table_autoinc_lock(prebuilt->table); + + /* Since a table can already be "open" in InnoDB's internal + data dictionary, we only init the autoinc counter once, the + first time the table is loaded. We can safely reuse the + autoinc value from a previous MySQL open. */ + if (dict_table_autoinc_read(prebuilt->table) == 0) { + + error = innobase_initialize_autoinc(); + /* Should always succeed! */ + ut_a(error == DB_SUCCESS); + } + + dict_table_autoinc_unlock(prebuilt->table); + } + DBUG_RETURN(0); } @@ -3401,7 +3465,7 @@ min value of the autoinc interval. Once that is fixed we can get rid of the special lock handling.*/ ulong -ha_innobase::innobase_autoinc_lock(void) +ha_innobase::innobase_lock_autoinc(void) /*====================================*/ /* out: DB_SUCCESS if all OK else error code */ @@ -3466,7 +3530,7 @@ ha_innobase::innobase_reset_autoinc( { ulint error; - error = innobase_autoinc_lock(); + error = innobase_lock_autoinc(); if (error == DB_SUCCESS) { @@ -3491,11 +3555,11 @@ ha_innobase::innobase_set_max_autoinc( { ulint error; - error = innobase_autoinc_lock(); + error = innobase_lock_autoinc(); if (error == DB_SUCCESS) { - dict_table_autoinc_update(prebuilt->table, auto_inc); + dict_table_autoinc_update_if_greater(prebuilt->table, auto_inc); dict_table_autoinc_unlock(prebuilt->table); } @@ -3705,7 +3769,7 @@ no_commit: update the table upper limit. Note: last_value will be 0 if get_auto_increment() was not called.*/ - if (auto_inc < col_max_value + if (auto_inc <= col_max_value && auto_inc > prebuilt->autoinc_last_value) { set_max_autoinc: ut_a(prebuilt->autoinc_increment > 0); @@ -3965,7 +4029,7 @@ ha_innobase::update_row( col_max_value = innobase_get_int_col_max_value( table->next_number_field); - if (auto_inc < col_max_value && auto_inc != 0) { + if (auto_inc <= col_max_value && auto_inc != 0) { ulonglong need; ulonglong offset; @@ -4020,30 +4084,6 @@ ha_innobase::delete_row( ha_statistic_increment(&SSV::ha_delete_count); - /* Only if the table has an AUTOINC column */ - if (table->found_next_number_field && record == table->record[0]) { - ulonglong dummy = 0; - - /* First check whether the AUTOINC sub-system has been - initialized using the AUTOINC mutex. If not then we - do it the "proper" way, by acquiring the heavier locks. */ - dict_table_autoinc_lock(prebuilt->table); - - if (!prebuilt->table->autoinc_inited) { - dict_table_autoinc_unlock(prebuilt->table); - - error = innobase_get_auto_increment(&dummy); - - if (error == DB_SUCCESS) { - dict_table_autoinc_unlock(prebuilt->table); - } else { - goto error_exit; - } - } else { - dict_table_autoinc_unlock(prebuilt->table); - } - } - if (!prebuilt->upd_node) { row_get_prebuilt_update_vector(prebuilt); } @@ -4058,7 +4098,6 @@ ha_innobase::delete_row( innodb_srv_conc_exit_innodb(trx); -error_exit: error = convert_error_code_to_mysql(error, user_thd); /* Tell the InnoDB server that there might be work for @@ -6135,16 +6174,7 @@ ha_innobase::info( } if (flag & HA_STATUS_AUTO && table->found_next_number_field) { - ulonglong auto_inc; - - if (innobase_read_and_init_auto_inc(&auto_inc) != 0) { - sql_print_error("Cannot get table %s auto-inc" - "counter value in ::info\n", - ib_table->name); - auto_inc = 0; - } - - stats.auto_increment_value = auto_inc; + stats.auto_increment_value = innobase_peek_autoinc(); } prebuilt->trx->op_info = (char*)""; @@ -7475,157 +7505,59 @@ ha_innobase::store_lock( return(to); } -/*********************************************************************** -This function initializes the auto-inc counter if it has not been -initialized yet. This function does not change the value of the auto-inc -counter if it already has been initialized. In parameter ret returns -the value of the auto-inc counter. */ +/******************************************************************************* +Read the next autoinc value. Acquire the relevant locks before reading +the AUTOINC value. If SUCCESS then the table AUTOINC mutex will be locked +on return and all relevant locks acquired. */ -int -ha_innobase::innobase_read_and_init_auto_inc( -/*=========================================*/ - /* out: 0 or generic MySQL - error code */ - ulonglong* value) /* out: the autoinc value */ +ulong +ha_innobase::innobase_get_autoinc( +/*==============================*/ + /* out: DB_SUCCESS or error code */ + ulonglong* value) /* out: autoinc value */ { - ulonglong auto_inc; - ibool stmt_start; - int mysql_error = 0; - dict_table_t* innodb_table = prebuilt->table; - ibool trx_was_not_started = FALSE; - - ut_a(prebuilt); - ut_a(prebuilt->table); - - /* Remember if we are in the beginning of an SQL statement. - This function must not change that flag. */ - stmt_start = prebuilt->sql_stat_start; - - /* Prepare prebuilt->trx in the table handle */ - update_thd(ha_thd()); - - if (prebuilt->trx->conc_state == TRX_NOT_STARTED) { - trx_was_not_started = TRUE; - } - - /* In case MySQL calls this in the middle of a SELECT query, release - possible adaptive hash latch to avoid deadlocks of threads */ - - trx_search_latch_release_if_reserved(prebuilt->trx); - - dict_table_autoinc_lock(prebuilt->table); - - auto_inc = dict_table_autoinc_read(prebuilt->table); - - /* Was the AUTOINC counter reset during normal processing, if - so then we simply start count from 1. No need to go to the index.*/ - if (auto_inc == 0 && innodb_table->autoinc_inited) { - ++auto_inc; - dict_table_autoinc_initialize(innodb_table, auto_inc); - } - - if (auto_inc == 0) { - dict_index_t* index; - const char* autoinc_col_name; - - ut_a(!innodb_table->autoinc_inited); - - index = innobase_get_index(table->s->next_number_index); - - autoinc_col_name = table->found_next_number_field->field_name; - - prebuilt->autoinc_error = row_search_max_autoinc( - index, autoinc_col_name, &auto_inc); - - if (prebuilt->autoinc_error == DB_SUCCESS) { - if (auto_inc < ~0x0ULL) { - ++auto_inc; - } - dict_table_autoinc_initialize(innodb_table, auto_inc); - } else { - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: Error: (%lu) Couldn't read " - "the max AUTOINC value from the index (%s).\n", - prebuilt->autoinc_error, index->name); - - mysql_error = 1; - } - } - - *value = auto_inc; - - dict_table_autoinc_unlock(prebuilt->table); + *value = 0; + + prebuilt->autoinc_error = innobase_lock_autoinc(); - /* Since MySQL does not seem to call autocommit after SHOW TABLE - STATUS (even if we would register the trx here), we commit our - transaction here if it was started here. This is to eliminate a - dangling transaction. If the user had AUTOCOMMIT=0, then SHOW - TABLE STATUS does leave a dangling transaction if the user does not - himself call COMMIT. */ + if (prebuilt->autoinc_error == DB_SUCCESS) { - if (trx_was_not_started) { + /* Determine the first value of the interval */ + *value = dict_table_autoinc_read(prebuilt->table); - innobase_commit_low(prebuilt->trx); + /* It should have been initialized during open. */ + ut_a(*value != 0); } - - prebuilt->sql_stat_start = stmt_start; - - return(mysql_error); + + return(ulong(prebuilt->autoinc_error)); } -/******************************************************************************* -Read the next autoinc value, initialize the table if it's not initialized. -On return if there is no error then the tables AUTOINC lock is locked.*/ +/*********************************************************************** +This function reads the global auto-inc counter. It doesn't use the +AUTOINC lock even if the lock mode is set to TRADITIONAL. */ -ulint -ha_innobase::innobase_get_auto_increment( -/*=====================================*/ - ulonglong* value) /* out: autoinc value */ +ulonglong +ha_innobase::innobase_peek_autoinc() +/*================================*/ + /* out: the autoinc value */ { - *value = 0; - - /* Note: If the table is not initialized when we attempt the - read below. We initialize the table's auto-inc counter and - always do a reread of the AUTOINC value. */ - do { - /* We need to send the correct error code to the client - because handler::get_auto_increment() doesn't allow a way - to return the specific error for why it failed. */ - prebuilt->autoinc_error = innobase_autoinc_lock(); - - if (prebuilt->autoinc_error == DB_SUCCESS) { - ulonglong autoinc; - - /* Determine the first value of the interval */ - autoinc = dict_table_autoinc_read(prebuilt->table); - - /* We need to initialize the AUTO-INC value, for - that we release all locks.*/ - if (autoinc == 0) { - trx_t* trx; + ulonglong auto_inc; + dict_table_t* innodb_table; - trx = prebuilt->trx; - dict_table_autoinc_unlock(prebuilt->table); + ut_a(prebuilt != NULL); + ut_a(prebuilt->table != NULL); - /* If we had reserved the AUTO-INC - lock in this SQL statement we release - it before retrying.*/ - row_unlock_table_autoinc_for_mysql(trx); + innodb_table = prebuilt->table; - /* Just to make sure */ - ut_a(!trx->auto_inc_lock); + dict_table_autoinc_lock(innodb_table); - /* Will set prebuilt->autoinc_error if there - is a problem during init. */ - innobase_read_and_init_auto_inc(&autoinc); + auto_inc = dict_table_autoinc_read(innodb_table); - } else { - *value = autoinc; - } - } - } while (*value == 0 && prebuilt->autoinc_error == DB_SUCCESS); + ut_a(auto_inc > 0); - return(prebuilt->autoinc_error); + dict_table_autoinc_unlock(innodb_table); + + return(auto_inc); } /******************************************************************************* @@ -7652,7 +7584,7 @@ ha_innobase::get_auto_increment( /* Prepare prebuilt->trx in the table handle */ update_thd(ha_thd()); - error = innobase_get_auto_increment(&autoinc); + error = innobase_get_autoinc(&autoinc); if (error != DB_SUCCESS) { *first_value = (~(ulonglong) 0); @@ -7717,7 +7649,7 @@ ha_innobase::get_auto_increment( ut_a(prebuilt->autoinc_last_value >= *first_value); /* Update the table autoinc variable */ - dict_table_autoinc_update( + dict_table_autoinc_update_if_greater( prebuilt->table, prebuilt->autoinc_last_value); } else { /* This will force write_row() into attempting an update @@ -7755,6 +7687,11 @@ ha_innobase::reset_auto_increment( DBUG_RETURN(error); } + /* The next value can never be 0. */ + if (value == 0) { + value = 1; + } + innobase_reset_autoinc(value); DBUG_RETURN(0); diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 95890e2215d..8ca72ee1a60 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -72,13 +72,15 @@ class ha_innobase: public handler int update_thd(THD* thd); int change_active_index(uint keynr); int general_fetch(uchar* buf, uint direction, uint match_mode); - int innobase_read_and_init_auto_inc(ulonglong* ret); - ulong innobase_autoinc_lock(); + ulong innobase_lock_autoinc(); + ulonglong innobase_peek_autoinc(); ulong innobase_set_max_autoinc(ulonglong auto_inc); ulong innobase_reset_autoinc(ulonglong auto_inc); - ulong innobase_get_auto_increment(ulonglong* value); + ulong innobase_get_autoinc(ulonglong* value); + ulong innobase_update_autoinc(ulonglong auto_inc); + ulong innobase_initialize_autoinc(); dict_index_t* innobase_get_index(uint keynr); - ulonglong innobase_get_int_col_max_value(const Field* field); + ulonglong innobase_get_int_col_max_value(const Field* field); /* Init values for the class: */ public: diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index f60775c8c2f..7d5ff09c7a6 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -178,8 +178,7 @@ dict_table_autoinc_lock( /*====================*/ dict_table_t* table); /* in: table */ /************************************************************************ -Initializes the autoinc counter. It is not an error to initialize an already -initialized counter. */ +Unconditionally set the autoinc counter. */ void dict_table_autoinc_initialize( @@ -196,12 +195,12 @@ dict_table_autoinc_read( /* out: value for a new row, or 0 */ dict_table_t* table); /* in: table */ /************************************************************************ -Updates the autoinc counter if the value supplied is equal or bigger than the -current value. If not inited, does nothing. */ +Updates the autoinc counter if the value supplied is greater than the +current value. */ void -dict_table_autoinc_update( -/*======================*/ +dict_table_autoinc_update_if_greater( +/*=================================*/ dict_table_t* table, /* in: table */ ib_ulonglong value); /* in: value which was assigned to a row */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 6e5435493cb..ac28fdb1bae 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -405,10 +405,6 @@ struct dict_table_struct{ mutex_t autoinc_mutex; /* mutex protecting the autoincrement counter */ - ibool autoinc_inited; - /* TRUE if the autoinc counter has been - inited; MySQL gets the init value by executing - SELECT MAX(auto inc column) */ ib_ulonglong autoinc;/* autoinc counter value to give to the next inserted row */ ulong n_waiting_or_granted_auto_inc_locks; diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 2d1cf22e4e7..d76af54b420 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -2910,7 +2910,7 @@ next_rec: /* MySQL calls ha_innobase::reset_auto_increment() which does the same thing. */ dict_table_autoinc_lock(table); - dict_table_autoinc_initialize(table, 0); + dict_table_autoinc_initialize(table, 1); dict_table_autoinc_unlock(table); dict_update_statistics(table); -- cgit v1.2.1 From 5681a0dfdd34292795ea71cbd57860999096f0d9 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Sun, 14 Dec 2008 14:26:31 -0700 Subject: Apply InnoDB snapshot innodb-5.1-ss2858, part 16. Fix merge mistake which resulted in a duplicate test case for bug 38231. --- mysql-test/r/innodb_bug38231.result | 11 ----- mysql-test/t/innodb_bug38231.test | 83 ------------------------------------- 2 files changed, 94 deletions(-) diff --git a/mysql-test/r/innodb_bug38231.result b/mysql-test/r/innodb_bug38231.result index b5d1d91ddc0..2f909779755 100644 --- a/mysql-test/r/innodb_bug38231.result +++ b/mysql-test/r/innodb_bug38231.result @@ -9,14 +9,3 @@ a TRUNCATE TABLE bug38231; COMMIT; DROP TABLE bug38231; -SET storage_engine=InnoDB; -INSERT INTO bug38231 VALUES (1), (10), (300); -SET autocommit=0; -SELECT * FROM bug38231 FOR UPDATE; -a -1 -10 -300 -TRUNCATE TABLE bug38231; -COMMIT; -DROP TABLE bug38231; diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test index 7ee35b2bc78..5b87969f062 100644 --- a/mysql-test/t/innodb_bug38231.test +++ b/mysql-test/t/innodb_bug38231.test @@ -81,86 +81,3 @@ COMMIT; -- disconnect con4 DROP TABLE bug38231; -# -# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK -# http://bugs.mysql.com/38231 -# - --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we care only that the following SQL commands do not crash the server --- disable_query_log --- disable_result_log - -DROP TABLE IF EXISTS bug38231; -CREATE TABLE bug38231 (a INT); - --- connect (con1,localhost,root,,) --- connect (con2,localhost,root,,) --- connect (con3,localhost,root,,) - --- connection con1 -SET autocommit=0; -LOCK TABLE bug38231 WRITE; - --- connection con2 -SET autocommit=0; --- send -LOCK TABLE bug38231 WRITE; - --- connection con3 -SET autocommit=0; --- send -LOCK TABLE bug38231 WRITE; - --- connection default --- send -TRUNCATE TABLE bug38231; - --- connection con1 -# give time to TRUNCATE and others to be executed; without sleep, sometimes -# UNLOCK executes before TRUNCATE --- sleep 0.2 -# this crashes the server if the bug is present -UNLOCK TABLES; - -# clean up - --- connection con2 -UNLOCK TABLES; - --- connection con3 -UNLOCK TABLES; - --- connection default - --- disconnect con1 --- disconnect con2 --- disconnect con3 - -# test that TRUNCATE works with with row-level locks - --- enable_query_log --- enable_result_log - -INSERT INTO bug38231 VALUES (1), (10), (300); - --- connect (con4,localhost,root,,) - --- connection con4 -SET autocommit=0; -SELECT * FROM bug38231 FOR UPDATE; - --- connection default -TRUNCATE TABLE bug38231; - --- connection con4 -COMMIT; - --- connection default - --- disconnect con4 - -DROP TABLE bug38231; -- cgit v1.2.1 From 22d47a6c3699eea095c7a67e205b1aa637d340ef Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Mon, 15 Dec 2008 23:58:16 +0100 Subject: Update test result file for binlog_innodb.result; the tested values (change in binlog_cache_use status variable) don't change, just the starting value is reduced. --- mysql-test/suite/binlog/r/binlog_innodb.result | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result index adc90d007bd..896d8f734fc 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_innodb.result @@ -115,14 +115,14 @@ master-bin.000001 # Xid # # COMMIT /* XID */ DROP TABLE t1; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 15 +Binlog_cache_use 13 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 0 create table t1 (a int) engine=innodb; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 16 +Binlog_cache_use 14 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 @@ -131,7 +131,7 @@ delete from t1; commit; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 17 +Binlog_cache_use 15 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 -- cgit v1.2.1 From 23d569edcea37c1dbb48fa2933ab476120476546 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Tue, 16 Dec 2008 12:44:18 +0100 Subject: post push fix for bug#40595 Addition of hander function was_semi_consistent_read mysql-test/r/partition_innodb_semi_consistent.result: post push fix for bug#40595 Addition of hander function was_semi_consistent_read Added test result mysql-test/t/partition_innodb_semi_consistent-master.opt: post push fix for bug#40595 Addition of hander function was_semi_consistent_read Added test opt file mysql-test/t/partition_innodb_semi_consistent.test: post push fix for bug#40595 Addition of hander function was_semi_consistent_read Added test case sql/ha_partition.cc: post push fix for bug#40595 Addition of hander function was_semi_consistent_read The lack of was_semi_consistent_read opened a regression for bug-31310 when useing a partitioned InnoDB table --- .../r/partition_innodb_semi_consistent.result | 128 ++++++++++++++ .../t/partition_innodb_semi_consistent-master.opt | 1 + mysql-test/t/partition_innodb_semi_consistent.test | 194 +++++++++++++++++++++ sql/ha_partition.cc | 30 ++++ sql/ha_partition.h | 6 +- 5 files changed, 358 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/partition_innodb_semi_consistent.result create mode 100644 mysql-test/t/partition_innodb_semi_consistent-master.opt create mode 100644 mysql-test/t/partition_innodb_semi_consistent.test diff --git a/mysql-test/r/partition_innodb_semi_consistent.result b/mysql-test/r/partition_innodb_semi_consistent.result new file mode 100644 index 00000000000..1bb39af043a --- /dev/null +++ b/mysql-test/r/partition_innodb_semi_consistent.result @@ -0,0 +1,128 @@ +drop table if exists t1; +set binlog_format=mixed; +set session transaction isolation level read committed; +create table t1(a int not null) +engine=innodb +DEFAULT CHARSET=latin1 +PARTITION BY RANGE(a) +(PARTITION p0 VALUES LESS THAN (20), +PARTITION p1 VALUES LESS THAN MAXVALUE); +insert into t1 values (1),(2),(3),(4),(5),(6),(7); +set autocommit=0; +select * from t1 where a=3 lock in share mode; +a +3 +set binlog_format=mixed; +set session transaction isolation level read committed; +set autocommit=0; +update t1 set a=10 where a=5; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +update t1 set a=10 where a=5; +select * from t1 where a=2 for update; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +select * from t1 where a=2 limit 1 for update; +a +2 +update t1 set a=11 where a=6; +update t1 set a=12 where a=2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +update t1 set a=13 where a=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +update t1 set a=14 where a=1; +commit; +select * from t1; +a +10 +11 +14 +2 +3 +4 +7 +drop table t1; +SET SESSION AUTOCOMMIT = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +set binlog_format=mixed; +# Switch to connection con1 +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256)) +ENGINE = InnoDB +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (300), +PARTITION p1 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1,2); +# 1. test for locking: +BEGIN; +UPDATE t1 SET b = 12 WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +1 12 +# Switch to connection con2 +UPDATE t1 SET b = 21 WHERE a = 1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +# Switch to connection con1 +SELECT * FROM t1; +a b +1 12 +ROLLBACK; +# 2. test for serialized update: +CREATE TABLE t2 (a INT); +TRUNCATE t1; +INSERT INTO t1 VALUES (1,'init'); +CREATE PROCEDURE p1() +BEGIN +UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; +INSERT INTO t2 VALUES (); +END| +BEGIN; +UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +1 init+con1 +# Switch to connection con2 +CALL p1;; +# Switch to connection con1 +SELECT * FROM t1; +a b +1 init+con1 +COMMIT; +SELECT * FROM t1; +a b +1 init+con1 +# Switch to connection con2 +SELECT * FROM t1; +a b +1 init+con1+con2 +# Switch to connection con1 +# 3. test for updated key column: +TRUNCATE t1; +TRUNCATE t2; +INSERT INTO t1 VALUES (1,'init'); +BEGIN; +UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +SELECT * FROM t1; +a b +2 init+con1 +# Switch to connection con2 +CALL p1;; +# Switch to connection con1 +SELECT * FROM t1; +a b +2 init+con1 +COMMIT; +SELECT * FROM t1; +a b +2 init+con1 +# Switch to connection con2 +SELECT * FROM t1; +a b +2 init+con1 +DROP PROCEDURE p1; +DROP TABLE t1, t2; diff --git a/mysql-test/t/partition_innodb_semi_consistent-master.opt b/mysql-test/t/partition_innodb_semi_consistent-master.opt new file mode 100644 index 00000000000..e76299453d3 --- /dev/null +++ b/mysql-test/t/partition_innodb_semi_consistent-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=2 diff --git a/mysql-test/t/partition_innodb_semi_consistent.test b/mysql-test/t/partition_innodb_semi_consistent.test new file mode 100644 index 00000000000..cfa170f575b --- /dev/null +++ b/mysql-test/t/partition_innodb_semi_consistent.test @@ -0,0 +1,194 @@ +-- source include/have_partition.inc +-- source include/not_embedded.inc +-- source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# basic tests of semi-consistent reads +# for verifying Bug#40595: Non-matching rows not released with READ-COMMITTED +# on tables with partitions + +connect (a,localhost,root,,); +connect (b,localhost,root,,); +connection a; +set binlog_format=mixed; +set session transaction isolation level read committed; +create table t1(a int not null) +engine=innodb +DEFAULT CHARSET=latin1 +PARTITION BY RANGE(a) +(PARTITION p0 VALUES LESS THAN (20), + PARTITION p1 VALUES LESS THAN MAXVALUE); +insert into t1 values (1),(2),(3),(4),(5),(6),(7); +set autocommit=0; +# this should lock the entire table +select * from t1 where a=3 lock in share mode; +connection b; +set binlog_format=mixed; +set session transaction isolation level read committed; +set autocommit=0; +-- error ER_LOCK_WAIT_TIMEOUT +update t1 set a=10 where a=5; +connection a; +#DELETE FROM t1 WHERE a=5; +commit; +connection b; +update t1 set a=10 where a=5; +connection a; +-- error ER_LOCK_WAIT_TIMEOUT +select * from t1 where a=2 for update; +# this should lock the records (1),(2) +select * from t1 where a=2 limit 1 for update; +connection b; +update t1 set a=11 where a=6; +-- error ER_LOCK_WAIT_TIMEOUT +update t1 set a=12 where a=2; +-- error ER_LOCK_WAIT_TIMEOUT +update t1 set a=13 where a=1; +connection a; +commit; +connection b; +update t1 set a=14 where a=1; +commit; +connection a; +--sorted_result +select * from t1; +drop table t1; + +connection default; +disconnect a; +disconnect b; + +# +# Bug #31310: Locked rows silently skipped in read-committed isolation level. +# (This also tests the '*_semi_consistent*' functions in partitioning) +# Copied from include/mix1.inc + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +SET SESSION AUTOCOMMIT = 0; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +set binlog_format=mixed; +--echo # Switch to connection con1 +connection con1; + +eval +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256)) +ENGINE = InnoDB +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (300), + PARTITION p1 VALUES LESS THAN MAXVALUE); +INSERT INTO t1 VALUES (1,2); + +--echo # 1. test for locking: + +BEGIN; +--enable_info +UPDATE t1 SET b = 12 WHERE a = 1; +--disable_info +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; + +--enable_info +--disable_abort_on_error +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET b = 21 WHERE a = 1; +--disable_info + +--echo # Switch to connection con1 +connection con1; +SELECT * FROM t1; +ROLLBACK; + +--echo # 2. test for serialized update: + +CREATE TABLE t2 (a INT); + +TRUNCATE t1; +INSERT INTO t1 VALUES (1,'init'); + +DELIMITER |; +CREATE PROCEDURE p1() +BEGIN + UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; + INSERT INTO t2 VALUES (); +END| +DELIMITER ;| + +BEGIN; +--enable_info +UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1; +--disable_info +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; + +--send CALL p1; + +--echo # Switch to connection con1 +connection con1; +SELECT * FROM t1; +COMMIT; + +let $bug31310 = 1; +while ($bug31310) +{ + let $bug31310= `SELECT 1 - COUNT(*) FROM t2`; +} + +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; +--reap +SELECT * FROM t1; + +--echo # Switch to connection con1 +connection con1; + +--echo # 3. test for updated key column: + +TRUNCATE t1; +TRUNCATE t2; + +INSERT INTO t1 VALUES (1,'init'); + +BEGIN; +--enable_info +UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1; +--disable_info +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; + +--send CALL p1; + +--echo # Switch to connection con1 +connection con1; +SELECT * FROM t1; +COMMIT; + +let $bug31310 = 1; +while ($bug31310) +{ + let $bug31310= `SELECT 1 - COUNT(*) FROM t2`; +} + +SELECT * FROM t1; + +--echo # Switch to connection con2 +connection con2; +SELECT * FROM t1; + +connection default; +disconnect con1; +disconnect con2; +DROP PROCEDURE p1; +DROP TABLE t1, t2; + diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 852f437b213..47d2d36ac8d 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2818,6 +2818,36 @@ void ha_partition::unlock_row() DBUG_VOID_RETURN; } +/** + Check if semi consistent read was used + + SYNOPSIS + was_semi_consistent_read() + + RETURN VALUE + TRUE Previous read was a semi consistent read + FALSE Previous read was not a semi consistent read + + DESCRIPTION + See handler.h: + In an UPDATE or DELETE, if the row under the cursor was locked by another + transaction, and the engine used an optimistic read of the last + committed row value under the cursor, then the engine returns 1 from this + function. MySQL must NOT try to update this optimistic value. If the + optimistic value does not match the WHERE condition, MySQL can decide to + skip over this row. Currently only works for InnoDB. This can be used to + avoid unnecessary lock waits. + + If this method returns nonzero, it will also signal the storage + engine that the next read will be a locking re-read of the row. +*/ +bool ha_partition::was_semi_consistent_read() +{ + DBUG_ENTER("ha_partition::was_semi_consistent_read"); + DBUG_ASSERT(m_last_part < m_tot_parts && + bitmap_is_set(&(m_part_info->used_partitions), m_last_part)); + DBUG_RETURN(m_file[m_last_part]->was_semi_consistent_read()); +} /** Use semi consistent read if possible diff --git a/sql/ha_partition.h b/sql/ha_partition.h index dd06d8d647b..bae2d03a8ce 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -112,7 +112,7 @@ private: uint m_reorged_parts; // Number of reorganised parts uint m_tot_parts; // Total number of partitions; uint m_no_locks; // For engines like ha_blackhole, which needs no locks - uint m_last_part; // Last file that we update,write + uint m_last_part; // Last file that we update,write,read int m_lock_type; // Remembers type of last // external_lock part_id_range m_part_spec; // Which parts to scan @@ -325,6 +325,10 @@ public: Call to unlock rows not to be updated in transaction */ virtual void unlock_row(); + /* + Check if semi consistent read + */ + virtual bool was_semi_consistent_read(); /* Call to hint about semi consistent read */ -- cgit v1.2.1 From 3ce026ec2f66a73be82a26055dd4761479a73811 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 16 Dec 2008 10:12:22 -0200 Subject: Fix warnings and bug spotted by gcc-4.3. Related to operator precedence and associativity. Make the expressions as explicit as possible. sql/field.h: Silence gcc-4.3 warning: be more explicit. sql/item.cc: Silence gcc-4.3 warning: be more explicit. sql/item_sum.cc: Silence gcc-4.3 warning: be more explicit. sql/log_event.cc: Silence gcc-4.3 warning: be more explicit. sql/spatial.h: Silence gcc-4.3 warning: be more explicit. sql/sql_lex.cc: Silence gcc-4.3 warning: be more explicit. sql/table.h: Silence gcc-4.3 warning: be more explicit. storage/federated/ha_federated.cc: Fix operator precedence bug. storage/heap/ha_heap.cc: Silence gcc-4.3 warning: be more explicit. --- sql/field.h | 2 +- sql/item.cc | 6 +++--- sql/item_sum.cc | 7 +++---- sql/log_event.cc | 2 +- sql/spatial.h | 10 +++++----- sql/sql_lex.cc | 2 +- sql/table.h | 2 +- storage/federated/ha_federated.cc | 2 +- storage/heap/ha_heap.cc | 2 +- 9 files changed, 17 insertions(+), 18 deletions(-) diff --git a/sql/field.h b/sql/field.h index 81905cc64ae..23033e6cc7a 100644 --- a/sql/field.h +++ b/sql/field.h @@ -209,7 +209,7 @@ public: memcpy(ptr, ptr + l_offset, pack_length()); if (null_ptr) *null_ptr= ((*null_ptr & (uchar) ~null_bit) | - null_ptr[l_offset] & null_bit); + (null_ptr[l_offset] & null_bit)); } virtual bool binary() const { return 1; } virtual bool zero_pack() const { return 1; } diff --git a/sql/item.cc b/sql/item.cc index 7f85713915d..b8fcdb832d4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2628,7 +2628,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type, if (value.time.year > 9999 || value.time.month > 12 || value.time.day > 31 || - time_type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 || + (time_type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23) || value.time.minute > 59 || value.time.second > 59) { char buff[MAX_DATE_STRING_REP_LENGTH]; @@ -4840,8 +4840,8 @@ int Item::save_in_field(Field *field, bool no_conversions) { int error; if (result_type() == STRING_RESULT || - result_type() == REAL_RESULT && - field->result_type() == STRING_RESULT) + (result_type() == REAL_RESULT && + field->result_type() == STRING_RESULT)) { String *result; CHARSET_INFO *cs= collation.collation; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index c2b3b954634..1821136cc9d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -654,8 +654,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref) return TRUE; // 'item' can be changed during fix_fields - if (!item->fixed && - item->fix_fields(thd, args) || + if ((!item->fixed && item->fix_fields(thd, args)) || (item= args[0])->check_cols(1)) return TRUE; decimals=item->decimals; @@ -981,8 +980,8 @@ void Item_sum_distinct::fix_length_and_dec() integers each <= 2^32. */ if (table_field_type == MYSQL_TYPE_INT24 || - table_field_type >= MYSQL_TYPE_TINY && - table_field_type <= MYSQL_TYPE_LONG) + (table_field_type >= MYSQL_TYPE_TINY && + table_field_type <= MYSQL_TYPE_LONG)) { val.traits= Hybrid_type_traits_fast_decimal::instance(); break; diff --git a/sql/log_event.cc b/sql/log_event.cc index 0d03593946d..cd8fa0c3a85 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2680,7 +2680,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, if (!(flags & LOG_EVENT_SUPPRESS_USE_F) && db) { - if (different_db= memcmp(print_event_info->db, db, db_len + 1)) + if ((different_db= memcmp(print_event_info->db, db, db_len + 1))) memcpy(print_event_info->db, db, db_len + 1); if (db[0] && different_db) my_b_printf(file, "use %s%s\n", db, print_event_info->delimiter); diff --git a/sql/spatial.h b/sql/spatial.h index f806861290e..69a1f24506e 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -116,12 +116,12 @@ struct MBR int touches(const MBR *mbr) { /* The following should be safe, even if we compare doubles */ - return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) && - ((mbr->ymin >= ymin) && (mbr->ymin <= ymax) || - (mbr->ymax >= ymin) && (mbr->ymax <= ymax))) || + return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) && + (((mbr->ymin >= ymin) && (mbr->ymin <= ymax)) || + ((mbr->ymax >= ymin) && (mbr->ymax <= ymax)))) || (((mbr->ymin == ymax) || (mbr->ymax == ymin)) && - ((mbr->xmin >= xmin) && (mbr->xmin <= xmax) || - (mbr->xmax >= xmin) && (mbr->xmax <= xmax)))); + (((mbr->xmin >= xmin) && (mbr->xmin <= xmax)) || + ((mbr->xmax >= xmin) && (mbr->xmax <= xmax))))); } int within(const MBR *mbr) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 983d53a041d..7d0a4d18d34 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2002,7 +2002,7 @@ void st_select_lex::print_limit(THD *thd, item->substype() == Item_subselect::ALL_SUBS)) { DBUG_ASSERT(!item->fixed || - select_limit->val_int() == LL(1) && offset_limit == 0); + (select_limit->val_int() == LL(1) && offset_limit == 0)); return; } diff --git a/sql/table.h b/sql/table.h index 8d6473661ac..a6a256b30b6 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1363,7 +1363,7 @@ struct TABLE_LIST void cleanup_items(); bool placeholder() { - return derived || view || schema_table || create && !table->db_stat || + return derived || view || schema_table || (create && !table->db_stat) || !table; } void print(THD *thd, String *str, enum_query_type query_type); diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 2f1c5e51caa..6cfbd355c40 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -2828,7 +2828,7 @@ int ha_federated::info(uint flag) if (!(row= mysql_fetch_row(result))) goto error; - if (flag & HA_STATUS_VARIABLE | HA_STATUS_CONST) + if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST)) { /* deleted is set in ha_federated::info diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index be2914adac4..19863d83874 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -91,7 +91,7 @@ const char **ha_heap::bas_ext() const int ha_heap::open(const char *name, int mode, uint test_if_locked) { if ((test_if_locked & HA_OPEN_INTERNAL_TABLE) || - !(file= heap_open(name, mode)) && my_errno == ENOENT) + (!(file= heap_open(name, mode)) && my_errno == ENOENT)) { HA_CREATE_INFO create_info; internal_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE); -- cgit v1.2.1 From 692a879665e6a23d9daada405ddec21698477084 Mon Sep 17 00:00:00 2001 From: Matthias Leich Date: Tue, 16 Dec 2008 19:09:09 +0100 Subject: Fix for Bug#39854 events_scheduling fails sporadically on pushbuild Detail: - Choose the solution that was already in place (before last fix) for 6.0 - minor cleanup in comments --- mysql-test/r/events_scheduling.result | 12 ------------ mysql-test/t/events_scheduling.test | 28 +++++++--------------------- 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result index 63140bffaa4..7dfd10a53f8 100644 --- a/mysql-test/r/events_scheduling.result +++ b/mysql-test/r/events_scheduling.result @@ -62,18 +62,6 @@ CREATE EVENT event_4 ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES (1); -SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; -IF(SUM(a) >= 4, 'OK', 'ERROR') -OK -SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2; -IF(SUM(a) >= 4, 'OK', 'ERROR') -OK -SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3; -IF(SUM(a) >= 1, 'OK', 'ERROR') -OK -SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_4; -IF(SUM(a) >= 1, 'OK', 'ERROR') -OK SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2'; diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test index 87cfa42e283..041a2def490 100644 --- a/mysql-test/t/events_scheduling.test +++ b/mysql-test/t/events_scheduling.test @@ -58,8 +58,6 @@ ON COMPLETION PRESERVE DO INSERT INTO table_4 VALUES (1); -# Wait for the events to fire and check the data afterwards - # Let event_1 insert at least 4 records into the table let $wait_condition=select count(*) >= 4 from table_1; --source include/wait_condition.inc @@ -85,25 +83,13 @@ let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_4' and status='enabled'; --source include/wait_condition.inc -let $wait_condition=SELECT SUM(a) >= 4 FROM table_1; -source include/wait_condition.inc; -SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; - -# In case of a testing box under heavy load it cannot be guaranteed that -# it is really often enough checked if event_2 has to be executed. -# -> Bug#39854 events_scheduling fails sporadically on pushbuild -# Therefore we lowered here the original expectation of 5 to 4. -let $wait_condition=SELECT SUM(a) >= 4 FROM table_2; -source include/wait_condition.inc; -SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2; - -let $wait_condition=SELECT SUM(a) >= 1 FROM table_3; -source include/wait_condition.inc; -SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3; - -let $wait_condition=SELECT SUM(a) >= 1 FROM table_4; -source include/wait_condition.inc; -SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_4; +# +# On a busy system the scheduler may skip execution of events, +# we can't reliably expect that the data in a table to be modified +# by an event will be exact. Thus we do not SELECT from the tables +# in this test. See also +# Bug#39854 events_scheduling fails sporadically on pushbuild +# SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS -- cgit v1.2.1 From 952d284ba4617958840005d314ae8d19428df1c3 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 17 Dec 2008 17:23:21 +0400 Subject: Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines(for 5.1) mysql-test/r/myisampack.result: result fix mysql-test/t/myisampack.test: test case fix --- mysql-test/r/myisampack.result | 2 +- mysql-test/r/status2.result | 73 ++++++++++++++++++++++++++++++++++++++++++ mysql-test/t/myisampack.test | 2 +- mysql-test/t/status2.test | 68 +++++++++++++++++++++++++++++++++++++++ sql/mysqld.cc | 8 +---- sql/sql_class.h | 11 +++++-- sql/sql_parse.cc | 22 ++++++++++++- 7 files changed, 174 insertions(+), 12 deletions(-) create mode 100644 mysql-test/r/status2.result create mode 100644 mysql-test/t/status2.test diff --git a/mysql-test/r/myisampack.result b/mysql-test/r/myisampack.result index 14b6283bf8f..7ed9b86d887 100644 --- a/mysql-test/r/myisampack.result +++ b/mysql-test/r/myisampack.result @@ -28,7 +28,7 @@ Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; drop table if exists t1; -create table t1(f1 int, f2 varchar(255)); +create table t1(f1 int, f2 char(255)); insert into t1 values(1, 'foo'), (2, 'bar'); insert into t1 select * from t1; insert into t1 select * from t1; diff --git a/mysql-test/r/status2.result b/mysql-test/r/status2.result new file mode 100644 index 00000000000..146fb2adbaf --- /dev/null +++ b/mysql-test/r/status2.result @@ -0,0 +1,73 @@ +# +# Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines +# +FLUSH STATUS; +CREATE FUNCTION testQuestion() RETURNS INTEGER +BEGIN +DECLARE foo INTEGER; +DECLARE bar INTEGER; +SET foo=1; +SET bar=2; +RETURN foo; +END $$ +CREATE PROCEDURE testQuestion2() +BEGIN +SELECT 1; +END $$ +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c1 INT); +CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND +DO INSERT INTO t1 VALUES(1); +Assert Questions == 7 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 7 +SELECT testQuestion(); +testQuestion() +1 +Assert Questions == 9 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 9 +CALL testQuestion2(); +1 +1 +Assert Questions == 11 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 11 +SELECT 1; +1 +1 +Assert Questions == 13 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 13 +SELECT 1; +1 +1 +Assert Questions == 14 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 14 +CREATE TRIGGER trigg1 AFTER INSERT ON t1 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES (1); +END; +$$ +Assert Questions == 16 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 16 +INSERT INTO t1 VALUES (1); +Assert Questions == 18 +SHOW STATUS LIKE 'Questions'; +Variable_name Value +Questions 18 +DROP PROCEDURE testQuestion2; +DROP TRIGGER trigg1; +DROP FUNCTION testQuestion; +DROP EVENT ev1; +DROP TABLE t1,t2; +End of 6.0 tests diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test index 99767f81033..3b55154d433 100644 --- a/mysql-test/t/myisampack.test +++ b/mysql-test/t/myisampack.test @@ -38,7 +38,7 @@ DROP TABLE t1; --disable_warnings drop table if exists t1; --enable_warnings -create table t1(f1 int, f2 varchar(255)); +create table t1(f1 int, f2 char(255)); insert into t1 values(1, 'foo'), (2, 'bar'); insert into t1 select * from t1; insert into t1 select * from t1; diff --git a/mysql-test/t/status2.test b/mysql-test/t/status2.test new file mode 100644 index 00000000000..2d1541c54f2 --- /dev/null +++ b/mysql-test/t/status2.test @@ -0,0 +1,68 @@ +--source include/not_embedded.inc + +--echo # +--echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines +--echo # +FLUSH STATUS; +DELIMITER $$; +CREATE FUNCTION testQuestion() RETURNS INTEGER +BEGIN + DECLARE foo INTEGER; + DECLARE bar INTEGER; + SET foo=1; + SET bar=2; + RETURN foo; +END $$ +CREATE PROCEDURE testQuestion2() +BEGIN + SELECT 1; +END $$ +DELIMITER ;$$ +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c1 INT); +CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND + DO INSERT INTO t1 VALUES(1); + +--echo Assert Questions == 7 +SHOW STATUS LIKE 'Questions'; +SELECT testQuestion(); +--echo Assert Questions == 9 +SHOW STATUS LIKE 'Questions'; +CALL testQuestion2(); +--echo Assert Questions == 11 +SHOW STATUS LIKE 'Questions'; +SELECT 1; +--echo Assert Questions == 13 +SHOW STATUS LIKE 'Questions'; +connect (con1,localhost,root,,); +connection con1; +SELECT 1; +connection default; +disconnect con1; +--echo Assert Questions == 14 +SHOW STATUS LIKE 'Questions'; +DELIMITER $$; +CREATE TRIGGER trigg1 AFTER INSERT ON t1 + FOR EACH ROW BEGIN + INSERT INTO t2 VALUES (1); + END; +$$ +DELIMITER ;$$ +--echo Assert Questions == 16 +SHOW STATUS LIKE 'Questions'; +INSERT INTO t1 VALUES (1); +--echo Assert Questions == 18 +SHOW STATUS LIKE 'Questions'; +# TODO: Uncomment the lines below when FLUSH GLOBAL STATUS is implemented. +# FLUSH STATUS; +# SHOW GLOBAL STATUS LIKE 'Questions'; +DROP PROCEDURE testQuestion2; +DROP TRIGGER trigg1; +DROP FUNCTION testQuestion; +DROP EVENT ev1; +DROP TABLE t1,t2; +--echo End of 6.0 tests + diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 32e0dd1542c..d52ad5c6671 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6867,12 +6867,6 @@ The minimum value for this variable is 4096.", {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -static int show_question(THD *thd, SHOW_VAR *var, char *buff) -{ - var->type= SHOW_LONGLONG; - var->value= (char *)&thd->query_id; - return 0; -} static int show_net_compression(THD *thd, SHOW_VAR *var, char *buff) { @@ -7289,7 +7283,7 @@ SHOW_VAR status_vars[]= { {"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_NOFLUSH}, {"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_NOFLUSH}, #endif /*HAVE_QUERY_CACHE*/ - {"Questions", (char*) &show_question, SHOW_FUNC}, + {"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS}, #ifdef HAVE_REPLICATION {"Rpl_status", (char*) &show_rpl_status, SHOW_FUNC}, #endif diff --git a/sql/sql_class.h b/sql/sql_class.h index f5cf31d1030..96b73ea76a2 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -456,8 +456,15 @@ typedef struct system_status_var ulong com_stmt_fetch; ulong com_stmt_reset; ulong com_stmt_close; - /* + Number of statements sent from the client + */ + ulong questions; + /* + IMPORTANT! + SEE last_system_status_var DEFINITION BELOW. + Below 'last_system_status_var' are all variables which doesn't make any + sense to add to the /global/ status variable counter. Status variables which it does not make sense to add to global status variable counter */ @@ -470,7 +477,7 @@ typedef struct system_status_var counter */ -#define last_system_status_var com_stmt_close +#define last_system_status_var questions void mark_transaction_to_rollback(THD *thd, bool all); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f518e1ef9e8..bc10cadad48 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -971,8 +971,24 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->set_time(); VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query_id= global_query_id; - if (command != COM_STATISTICS && command != COM_PING) + + switch( command ) { + /* Ignore these statements. */ + case COM_STATISTICS: + case COM_PING: + break; + /* Only increase id on these statements but don't count them. */ + case COM_STMT_PREPARE: + case COM_STMT_CLOSE: + case COM_STMT_RESET: next_query_id(); + break; + /* Increase id and count all other statements. */ + default: + statistic_increment(thd->status_var.questions, &LOCK_status); + next_query_id(); + } + thread_running++; /* TODO: set thd->lex->sql_command to SQLCOM_END here */ VOID(pthread_mutex_unlock(&LOCK_thread_count)); @@ -1229,6 +1245,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query_length= length; thd->query= beginning_of_next_stmt; + /* + Count each statement from the client. + */ + statistic_increment(thd->status_var.questions, &LOCK_status); thd->query_id= next_query_id(); thd->set_time(); /* Reset the query start time. */ /* TODO: set thd->lex->sql_command to SQLCOM_END here */ -- cgit v1.2.1 From 3a42aab81c2f9b49a5f8ee3ed69af2d8fd1d5b0f Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 17 Dec 2008 17:24:34 +0400 Subject: BUG#39746 - Debug flag breaks struct definition (server crash) Altering a table with fulltext index[es] which use pluggable fulltext parser may cause server crash in debug builds. The problem was that ALTER TABLE code wrongly assigned fulltext parser name. Also fixed that altering a table with fulltext index[es] leave stale fulltext parser locks, which prevent fulltext parsers from being uninstalled after ALTER TABLE. mysql-test/include/have_simple_parser.inc: Added support for testing simple fulltext parser. mysql-test/mysql-test-run.pl: Added support for testing simple fulltext parser. mysql-test/r/fulltext_plugin.result: A test case for BUG#39746. mysql-test/r/have_simple_parser.require: Added support for testing simple fulltext parser. mysql-test/t/fulltext_plugin-master.opt: A test case for BUG#39746. mysql-test/t/fulltext_plugin.test: A test case for BUG#39746. sql/sql_table.cc: Fixed that alter table wrongly assigns fulltext parser name. parser_name member is only available during table creation. When we open existing table we must get parser_name from plugin_ref, which is handled by plugin_name() macro. sql/table.cc: Moved code that releases fulltext parsers into free_table_share(). This fixes stale fulltext parser locks set by ALTER TABLE, which are preventing fulltext parsers from being uninstalled. --- mysql-test/include/have_simple_parser.inc | 16 ++++++++++++++++ mysql-test/mysql-test-run.pl | 13 +++++++++++++ mysql-test/r/fulltext_plugin.result | 5 +++++ mysql-test/r/have_simple_parser.require | 2 ++ mysql-test/t/fulltext_plugin-master.opt | 1 + mysql-test/t/fulltext_plugin.test | 10 ++++++++++ sql/sql_table.cc | 2 +- sql/table.cc | 23 ++++++++++++----------- 8 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 mysql-test/include/have_simple_parser.inc create mode 100644 mysql-test/r/fulltext_plugin.result create mode 100644 mysql-test/r/have_simple_parser.require create mode 100644 mysql-test/t/fulltext_plugin-master.opt create mode 100644 mysql-test/t/fulltext_plugin.test diff --git a/mysql-test/include/have_simple_parser.inc b/mysql-test/include/have_simple_parser.inc new file mode 100644 index 00000000000..c85786bd524 --- /dev/null +++ b/mysql-test/include/have_simple_parser.inc @@ -0,0 +1,16 @@ +# +# Check if server has support for loading udf's +# i.e it will support dlopen +# +--require r/have_dynamic_loading.require +disable_query_log; +show variables like 'have_dynamic_loading'; +enable_query_log; + +# +# Check if the variable SIMPLE_PARSER is set +# +--require r/have_simple_parser.require +disable_query_log; +eval select LENGTH('$SIMPLE_PARSER') > 0 as 'have_simple_parser'; +enable_query_log; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 20a0b639e84..a6105d2edff 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -163,6 +163,7 @@ our $exe_my_print_defaults; our $exe_perror; our $lib_udf_example; our $lib_example_plugin; +our $lib_simple_parser; our $exe_libtool; our $opt_bench= 0; @@ -1717,6 +1718,10 @@ sub executable_setup () { mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'), "$glob_basedir/storage/example/.libs/ha_example.so",); + # Look for the simple_parser library + $lib_simple_parser= + mtr_file_exists(vs_config_dirs('plugin/fulltext', 'mypluglib.dll'), + "$glob_basedir/plugin/fulltext/.libs/mypluglib.so",); } # Look for mysqltest executable @@ -2199,6 +2204,14 @@ sub environment_setup () { $ENV{'EXAMPLE_PLUGIN_OPT'}= ($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : ""); + # ---------------------------------------------------- + # Add the path where mysqld will find mypluglib.so + # ---------------------------------------------------- + $ENV{'SIMPLE_PARSER'}= + ($lib_simple_parser ? basename($lib_simple_parser) : ""); + $ENV{'SIMPLE_PARSER_OPT'}= + ($lib_simple_parser ? "--plugin_dir=" . dirname($lib_simple_parser) : ""); + # ---------------------------------------------------- # Setup env so childs can execute myisampack and myisamchk # ---------------------------------------------------- diff --git a/mysql-test/r/fulltext_plugin.result b/mysql-test/r/fulltext_plugin.result new file mode 100644 index 00000000000..69ebbe07e9e --- /dev/null +++ b/mysql-test/r/fulltext_plugin.result @@ -0,0 +1,5 @@ +INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; +CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); +ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser; +DROP TABLE t1; +UNINSTALL PLUGIN simple_parser; diff --git a/mysql-test/r/have_simple_parser.require b/mysql-test/r/have_simple_parser.require new file mode 100644 index 00000000000..0e023bd6983 --- /dev/null +++ b/mysql-test/r/have_simple_parser.require @@ -0,0 +1,2 @@ +have_simple_parser +1 diff --git a/mysql-test/t/fulltext_plugin-master.opt b/mysql-test/t/fulltext_plugin-master.opt new file mode 100644 index 00000000000..a2554caa20b --- /dev/null +++ b/mysql-test/t/fulltext_plugin-master.opt @@ -0,0 +1 @@ +$SIMPLE_PARSER_OPT diff --git a/mysql-test/t/fulltext_plugin.test b/mysql-test/t/fulltext_plugin.test new file mode 100644 index 00000000000..31978dadc51 --- /dev/null +++ b/mysql-test/t/fulltext_plugin.test @@ -0,0 +1,10 @@ +--source include/have_simple_parser.inc + +# +# BUG#39746 - Debug flag breaks struct definition (server crash) +# +INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; +CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); +ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser; +DROP TABLE t1; +UNINSTALL PLUGIN simple_parser; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8ce4c0b0a46..51b16ba0f43 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5870,7 +5870,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, if (key_info->flags & HA_USES_BLOCK_SIZE) key_create_info.block_size= key_info->block_size; if (key_info->flags & HA_USES_PARSER) - key_create_info.parser_name= *key_info->parser_name; + key_create_info.parser_name= *plugin_name(key_info->parser); if (key_info->flags & HA_SPATIAL) key_type= Key::SPATIAL; diff --git a/sql/table.cc b/sql/table.cc index 1de47a48513..95753e5353a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -400,6 +400,8 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key, void free_table_share(TABLE_SHARE *share) { MEM_ROOT mem_root; + uint idx; + KEY *key_info; DBUG_ENTER("free_table_share"); DBUG_PRINT("enter", ("table: %s.%s", share->db.str, share->table_name.str)); DBUG_ASSERT(share->ref_count == 0); @@ -426,6 +428,16 @@ void free_table_share(TABLE_SHARE *share) plugin_unlock(NULL, share->db_plugin); share->db_plugin= NULL; + /* Release fulltext parsers */ + key_info= share->key_info; + for (idx= share->keys; idx; idx--, key_info++) + { + if (key_info->flags & HA_USES_PARSER) + { + plugin_unlock(NULL, key_info->parser); + key_info->flags= 0; + } + } /* We must copy mem_root from share because share is allocated through it */ memcpy((char*) &mem_root, (char*) &share->mem_root, sizeof(mem_root)); free_root(&mem_root, MYF(0)); // Free's share @@ -1943,22 +1955,11 @@ partititon_err: int closefrm(register TABLE *table, bool free_share) { int error=0; - uint idx; - KEY *key_info; DBUG_ENTER("closefrm"); DBUG_PRINT("enter", ("table: 0x%lx", (long) table)); if (table->db_stat) error=table->file->close(); - key_info= table->key_info; - for (idx= table->s->keys; idx; idx--, key_info++) - { - if (key_info->flags & HA_USES_PARSER) - { - plugin_unlock(NULL, key_info->parser); - key_info->flags= 0; - } - } my_free((char*) table->alias, MYF(MY_ALLOW_ZERO_PTR)); table->alias= 0; if (table->field) -- cgit v1.2.1 From 25c54b358f930802f914b3362edc4e09ecae1fb3 Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Wed, 17 Dec 2008 14:38:02 +0100 Subject: Final fix for bug#36773: Moved patch in 5.1 from rpl to bug team tree. --- mysql-test/include/wait_condition_sp.inc | 62 +++++++++++++ mysql-test/r/rpl_init_slave_func.result | 67 +++++++-------- mysql-test/t/rpl_init_slave_func-slave.opt | 1 - mysql-test/t/rpl_init_slave_func.test | 134 +++++++++++++++-------------- 4 files changed, 165 insertions(+), 99 deletions(-) create mode 100644 mysql-test/include/wait_condition_sp.inc delete mode 100644 mysql-test/t/rpl_init_slave_func-slave.opt diff --git a/mysql-test/include/wait_condition_sp.inc b/mysql-test/include/wait_condition_sp.inc new file mode 100644 index 00000000000..66301da557c --- /dev/null +++ b/mysql-test/include/wait_condition_sp.inc @@ -0,0 +1,62 @@ +# include/wait_condition.inc +# +# SUMMARY +# +# Waits until the passed statement returns true, or the operation +# times out. +# +# USAGE +# +# let $wait_condition= +# SELECT c = 3 FROM t; +# --source include/wait_condition.inc +# +# OR +# +# let $wait_timeout= 60; # Override default 30 seconds with 60. +# let $wait_condition= +# SELECT c = 3 FROM t; +# --source include/wait_condition.inc +# --echo Executed the test condition $wait_condition_reps times +# +# EXAMPLE +# events_bugs.test, events_time_zone.test +# + +--disable_query_log + +let $wait_counter= 300; +if ($wait_timeout) +{ + let $wait_counter= `SELECT $wait_timeout * 10`; +} +# Reset $wait_timeout so that its value won't be used on subsequent +# calls, and default will be used instead. +let $wait_timeout= 0; + +# Keep track of how many times the wait condition is tested +# This is used by some tests (e.g., main.status) +let $wait_condition_reps= 0; +while ($wait_counter) +{ + let $success= `$wait_condition`; + inc $wait_condition_reps; + if ($success) + { + let $wait_counter= 0; + } + if (!$success) + { + real_sleep 0.1; + dec $wait_counter; + } +} +if (!$success) +{ + echo Timeout in wait_condition.inc for $wait_condition; + show master status; + show slave status; +} + +--enable_query_log + diff --git a/mysql-test/r/rpl_init_slave_func.result b/mysql-test/r/rpl_init_slave_func.result index 3861f40e7d9..0d1f4d483d8 100644 --- a/mysql-test/r/rpl_init_slave_func.result +++ b/mysql-test/r/rpl_init_slave_func.result @@ -4,44 +4,43 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -'#--------------------FN_DYNVARS_037_01-------------------------#' -SET @@global.init_slave = "SET @a = 10"; -'connect (con1,localhost,root,,)' -'connection con1' -SELECT @@global.init_slave; -@@global.init_slave -SET @a = 10 -'connection master' -'#--------------------FN_DYNVARS_037_02-------------------------#' -'check if value in slave opt file is executed' -'connection slave' -show variables like 'init_slave'; -Variable_name Value -init_slave set global max_connections=500 -show variables like 'max_connections'; -Variable_name Value -max_connections 500 -reset master; -'check if value in slave opt file doesnt apply to master' -'connection master' -show variables like 'init_slave'; -Variable_name Value -init_slave SET @a = 10 -show variables like 'max_connections'; -Variable_name Value -max_connections 151 -'connection slave' -'try creating a temporary variable in init_slave' +connection slave +SET @start_max_connections= @@global.max_connections; +SET @start_init_slave= @@global.init_slave; +SET @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1'; +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column; +DESCRIBE t1; +Field Type Null Key Default Extra +my_column longtext NO NULL +DROP TABLE t1; +SELECT @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1'; +@@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1' +1 +Expect 1 +SELECT @@global.max_connections= @start_max_connections; +@@global.max_connections= @start_max_connections +1 +Expect 1 +STOP SLAVE; +RESET MASTER; +RESET SLAVE; +START SLAVE; +SELECT @@global.max_connections = @start_max_connections + 1; +@@global.max_connections = @start_max_connections + 1 +1 +Expect 1 SET @@global.init_slave = "SET @a=5"; -stop slave; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; +STOP SLAVE; +RESET MASTER; +RESET SLAVE; +START SLAVE; SHOW VARIABLES LIKE 'init_slave'; Variable_name Value init_slave SET @a=5 SELECT @a; @a NULL -'Bug#35365 SET statement in init_slave not execute if slave is restarted' -set global max_connections= default; +Expect NULL +SET @@global.max_connections= @start_max_connections; +SET @@global.init_slave= @start_init_slave; diff --git a/mysql-test/t/rpl_init_slave_func-slave.opt b/mysql-test/t/rpl_init_slave_func-slave.opt deleted file mode 100644 index 337e8a60d97..00000000000 --- a/mysql-test/t/rpl_init_slave_func-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---init-slave="set global max_connections=500" diff --git a/mysql-test/t/rpl_init_slave_func.test b/mysql-test/t/rpl_init_slave_func.test index b3d647f4394..f17cc1289b1 100644 --- a/mysql-test/t/rpl_init_slave_func.test +++ b/mysql-test/t/rpl_init_slave_func.test @@ -10,86 +10,92 @@ # # # Creation Date: 2008-03-08 # # Author: Rizwan # +# Modified: HHunger 2008-09-29 Fixed the bug by inserting the usual wait and # +# SQL-Satements to control master and slave, # +# deleted the sleep and made improvements like: # +# - Replaced the opt file by dynamic variables, # +# - Made the tests independant of the initial # +# values of the global variables, # +# - Reduced the test to the needed test case to # +# save run time, # +# - Beautification. # # # # Description: Test Cases of Dynamic System Variable init_slave # # that checks the behavior of this variable # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ############################################################################### source include/master-slave.inc; - ---echo '#--------------------FN_DYNVARS_037_01-------------------------#' -################################################################## -# Check if setting init_slave is changed in every new connection # -################################################################## - -SET @@global.init_slave = "SET @a = 10"; - ---echo 'connect (con1,localhost,root,,)' -connect (con1,localhost,root,,); ---echo 'connection con1' -connection con1; -SELECT @@global.init_slave; -disconnect con1; ---echo 'connection master' -connection master; - ---echo '#--------------------FN_DYNVARS_037_02-------------------------#' -#################################################### -# Begin the functionality Testing of init_slave # -#################################################### - -#==================================================== ---echo 'check if value in slave opt file is executed' -#==================================================== -save_master_pos; ---echo 'connection slave' +--echo connection slave connection slave; -sleep 1; -show variables like 'init_slave'; -show variables like 'max_connections'; -sync_with_master; -reset master; +# +# save the current values -#=============================================================== ---echo 'check if value in slave opt file doesnt apply to master' -#=============================================================== +SET @start_max_connections= @@global.max_connections; +SET @start_init_slave= @@global.init_slave; ---echo 'connection master' -connection master; -show variables like 'init_slave'; -show variables like 'max_connections'; -save_master_pos; ---echo 'connection slave' -connection slave; -sync_with_master; - -#======================================================= ---echo 'try creating a temporary variable in init_slave' -#======================================================= - -SET @@global.init_slave = "SET @a=5"; +# setting of a global value with an effect on the next start of the slave server +# check that @@global.init_slave could be set +let $my_init_slave= + 'SET @@global.max_connections = @@global.max_connections + 1'; +eval SET @@global.init_slave = $my_init_slave; -stop slave; ---wait_for_slave_to_stop -reset slave; -# Clean up old test tables +# show the data type of the variable --disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column; --enable_warnings -start slave; - +DESCRIBE t1; +DROP TABLE t1; +# +# check that the new setting of @@global.init_slave becomes immediately visible +eval SELECT @@global.init_slave = $my_init_slave; +--echo Expect 1 +# wait for the slave threads have set the global variable. +let $wait_timeout= 90; +let $wait_condition= SELECT @@global.max_connections = @start_max_connections; +--source include/wait_condition_sp.inc +# check that the action in init_slave does not happen immediately +SELECT @@global.max_connections= @start_max_connections; +--echo Expect 1 +# +# reset of the server +STOP SLAVE; +--wait_for_slave_to_stop +RESET MASTER; +RESET SLAVE; +START SLAVE; +source include/wait_for_slave_to_start.inc; +# +# wait for the slave threads have set the global variable. +let $wait_timeout= 90; +let $wait_condition= SELECT @@global.max_connections = @start_max_connections + 1; +--source include/wait_condition_sp.inc +# check that the action in init_slave was executed and had the intended effect +SELECT @@global.max_connections = @start_max_connections + 1; +--echo Expect 1 +# +# Setting a variable(which is local to a session) and must not be visible +SET @@global.init_slave = "SET @a=5"; +# +STOP SLAVE; +--wait_for_slave_to_stop +RESET MASTER; +RESET SLAVE; +START SLAVE; +source include/wait_for_slave_to_start.inc; +# SHOW VARIABLES LIKE 'init_slave'; +# expect NULL SELECT @a; - ---echo 'Bug#35365 SET statement in init_slave not execute if slave is restarted' - -# Restore value -set global max_connections= default; - +--echo Expect NULL +# +# Clean up +SET @@global.max_connections= @start_max_connections; +SET @@global.init_slave= @start_init_slave; ################################################## # End of functionality Testing for init_slave # ################################################## -- cgit v1.2.1 From 75344d3d3b8d1f1bcda90614326d7e3bbb0383d2 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 17 Dec 2008 19:45:34 +0400 Subject: Bug#29263 disabled storage engines omitted in SHOW ENGINES Static disabled plugins|engines and dynamic plugins which installed but disabled are not visible in I_S PLUGINS|ENGINES tables because they are not stored into global plugin array. The fix: add such plugins|engines to plugin array with PLUGIN_IS_DISABLED status. I_S.ENGINES 'Transactions', 'XA', 'Savepoints' fields have NULL value in this case. mysql-test/r/warnings_engine_disabled.result: test result mysql-test/suite/funcs_1/r/is_columns_is.result: result fix mysql-test/suite/funcs_1/r/is_engines.result: result fix mysql-test/t/warnings_engine_disabled.test: test case sql/sql_plugin.cc: store disabled plugins|engines into plugin array sql/sql_plugin.h: added PLUGIN_IS_DISABLED flag sql/sql_show.cc: added filling of 'engines'&'plugins' tables with disabled engines|plugins --- mysql-test/r/warnings_engine_disabled.result | 10 ++++++- mysql-test/suite/funcs_1/r/is_columns_is.result | 6 ++-- mysql-test/suite/funcs_1/r/is_engines.result | 18 +++++------ mysql-test/t/warnings_engine_disabled.test | 9 ++++-- sql/sql_plugin.cc | 40 +++++++++++++------------ sql/sql_plugin.h | 1 + sql/sql_show.cc | 39 ++++++++++++++++++++---- 7 files changed, 84 insertions(+), 39 deletions(-) diff --git a/mysql-test/r/warnings_engine_disabled.result b/mysql-test/r/warnings_engine_disabled.result index aa6170a60a7..e5d35fdaa5f 100644 --- a/mysql-test/r/warnings_engine_disabled.result +++ b/mysql-test/r/warnings_engine_disabled.result @@ -1,7 +1,15 @@ create table t1 (id int) engine=NDB; Warnings: +Warning 1286 Unknown table engine 'NDB' Warning 1266 Using storage engine MyISAM for table 't1' alter table t1 engine=NDB; Warnings: -Warning 1266 Using storage engine MyISAM for table 't1' +Warning 1286 Unknown table engine 'NDB' drop table t1; +SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ndbcluster'; +ENGINE SUPPORT +ndbcluster NO +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE +PLUGIN_NAME='ndbcluster'; +PLUGIN_NAME PLUGIN_STATUS +ndbcluster DISABLED diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 15466887ecc..94aa75c6db2 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -43,10 +43,10 @@ NULL information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NO varchar 64 192 NULL N NULL information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ENGINES COMMENT 3 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select NULL information_schema ENGINES ENGINE 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema ENGINES SAVEPOINTS 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select +NULL information_schema ENGINES SAVEPOINTS 6 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema ENGINES SUPPORT 2 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select -NULL information_schema ENGINES TRANSACTIONS 4 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select -NULL information_schema ENGINES XA 5 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select +NULL information_schema ENGINES TRANSACTIONS 4 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select +NULL information_schema ENGINES XA 5 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select NULL information_schema EVENTS CHARACTER_SET_CLIENT 22 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema EVENTS COLLATION_CONNECTION 23 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema EVENTS CREATED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select diff --git a/mysql-test/suite/funcs_1/r/is_engines.result b/mysql-test/suite/funcs_1/r/is_engines.result index ba98ddd8f1e..9965fc5ad73 100644 --- a/mysql-test/suite/funcs_1/r/is_engines.result +++ b/mysql-test/suite/funcs_1/r/is_engines.result @@ -31,27 +31,27 @@ Field Type Null Key Default Extra ENGINE varchar(64) NO SUPPORT varchar(8) NO COMMENT varchar(80) NO -TRANSACTIONS varchar(3) NO -XA varchar(3) NO -SAVEPOINTS varchar(3) NO +TRANSACTIONS varchar(3) YES NULL +XA varchar(3) YES NULL +SAVEPOINTS varchar(3) YES NULL SHOW CREATE TABLE information_schema.ENGINES; Table Create Table ENGINES CREATE TEMPORARY TABLE `ENGINES` ( `ENGINE` varchar(64) NOT NULL DEFAULT '', `SUPPORT` varchar(8) NOT NULL DEFAULT '', `COMMENT` varchar(80) NOT NULL DEFAULT '', - `TRANSACTIONS` varchar(3) NOT NULL DEFAULT '', - `XA` varchar(3) NOT NULL DEFAULT '', - `SAVEPOINTS` varchar(3) NOT NULL DEFAULT '' + `TRANSACTIONS` varchar(3) DEFAULT NULL, + `XA` varchar(3) DEFAULT NULL, + `SAVEPOINTS` varchar(3) DEFAULT NULL ) ENGINE=MEMORY DEFAULT CHARSET=utf8 SHOW COLUMNS FROM information_schema.ENGINES; Field Type Null Key Default Extra ENGINE varchar(64) NO SUPPORT varchar(8) NO COMMENT varchar(80) NO -TRANSACTIONS varchar(3) NO -XA varchar(3) NO -SAVEPOINTS varchar(3) NO +TRANSACTIONS varchar(3) YES NULL +XA varchar(3) YES NULL +SAVEPOINTS varchar(3) YES NULL ######################################################################## # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and # DDL on INFORMATION_SCHEMA tables are not supported diff --git a/mysql-test/t/warnings_engine_disabled.test b/mysql-test/t/warnings_engine_disabled.test index 0b09cff7b1e..b8751a062b7 100644 --- a/mysql-test/t/warnings_engine_disabled.test +++ b/mysql-test/t/warnings_engine_disabled.test @@ -4,7 +4,7 @@ # disable_query_log; --require r/true.require -select support = 'Disabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; +select support = 'NO' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; enable_query_log; @@ -16,4 +16,9 @@ create table t1 (id int) engine=NDB; alter table t1 engine=NDB; drop table t1; - +# +# Bug#29263 disabled storage engines omitted in SHOW ENGINES +# +SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ndbcluster'; +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE +PLUGIN_NAME='ndbcluster'; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 13b2bfef24d..0df1631294b 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -751,21 +751,22 @@ static bool plugin_add(MEM_ROOT *tmp_root, tmp.name.length= name_len; tmp.ref_count= 0; tmp.state= PLUGIN_IS_UNINITIALIZED; - if (!test_plugin_options(tmp_root, &tmp, argc, argv, true)) + if (test_plugin_options(tmp_root, &tmp, argc, argv, true)) + tmp.state= PLUGIN_IS_DISABLED; + + if ((tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) { - if ((tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) + plugin_array_version++; + if (!my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) { - plugin_array_version++; - if (!my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr)) - { - init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); - DBUG_RETURN(FALSE); - } - tmp_plugin_ptr->state= PLUGIN_IS_FREED; + init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); + DBUG_RETURN(FALSE); } - mysql_del_sys_var_chain(tmp.system_vars); - goto err; + tmp_plugin_ptr->state= PLUGIN_IS_FREED; } + mysql_del_sys_var_chain(tmp.system_vars); + goto err; + /* plugin was disabled */ plugin_dl_del(dl); DBUG_RETURN(FALSE); @@ -1145,11 +1146,12 @@ int plugin_init(int *argc, char **argv, int flags) tmp.plugin= plugin; tmp.name.str= (char *)plugin->name; tmp.name.length= strlen(plugin->name); - + tmp.state= 0; free_root(&tmp_root, MYF(MY_MARK_BLOCKS_FREE)); if (test_plugin_options(&tmp_root, &tmp, argc, argv, def_enabled)) - continue; - + tmp.state= PLUGIN_IS_DISABLED; + else + tmp.state= PLUGIN_IS_UNINITIALIZED; if (register_builtin(plugin, &tmp, &plugin_ptr)) goto err_unlock; @@ -1159,7 +1161,8 @@ int plugin_init(int *argc, char **argv, int flags) my_strcasecmp(&my_charset_latin1, plugin->name, "CSV")) continue; - if (plugin_initialize(plugin_ptr)) + if (plugin_ptr->state == PLUGIN_IS_UNINITIALIZED && + plugin_initialize(plugin_ptr)) goto err_unlock; /* @@ -1246,8 +1249,6 @@ static bool register_builtin(struct st_mysql_plugin *plugin, struct st_plugin_int **ptr) { DBUG_ENTER("register_builtin"); - - tmp->state= PLUGIN_IS_UNINITIALIZED; tmp->ref_count= 0; tmp->plugin_dl= 0; @@ -1296,7 +1297,7 @@ bool plugin_register_builtin(THD *thd, struct st_mysql_plugin *plugin) if (test_plugin_options(thd->mem_root, &tmp, &dummy_argc, NULL, true)) goto end; - + tmp.state= PLUGIN_IS_UNINITIALIZED; if ((result= register_builtin(plugin, &tmp, &ptr))) mysql_del_sys_var_chain(tmp.system_vars); @@ -1555,7 +1556,8 @@ void plugin_shutdown(void) We loop through all plugins and call deinit() if they have one. */ for (i= 0; i < count; i++) - if (!(plugins[i]->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_FREED))) + if (!(plugins[i]->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_FREED | + PLUGIN_IS_DISABLED))) { sql_print_information("Plugin '%s' will be forced to shutdown", plugins[i]->name.str); diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index e8f2cb6ee5e..8ae38d58845 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -54,6 +54,7 @@ typedef struct st_mysql_show_var SHOW_VAR; #define PLUGIN_IS_UNINITIALIZED 4 #define PLUGIN_IS_READY 8 #define PLUGIN_IS_DYING 16 +#define PLUGIN_IS_DISABLED 32 /* A handle for the dynamic library containing a plugin or plugins. */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 3fd06aba672..0128fd43d28 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -124,6 +124,9 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin, case PLUGIN_IS_READY: table->field[2]->store(STRING_WITH_LEN("ACTIVE"), cs); break; + case PLUGIN_IS_DISABLED: + table->field[2]->store(STRING_WITH_LEN("DISABLED"), cs); + break; default: DBUG_ASSERT(0); } @@ -3930,6 +3933,25 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, handlerton *default_type= ha_default_handlerton(thd); DBUG_ENTER("iter_schema_engines"); + + /* Disabled plugins */ + if (plugin_state(plugin) != PLUGIN_IS_READY) + { + + struct st_mysql_plugin *plug= plugin_decl(plugin); + if (!(wild && wild[0] && + wild_case_compare(scs, plug->name,wild))) + { + restore_record(table, s->default_values); + table->field[0]->store(plug->name, strlen(plug->name), scs); + table->field[1]->store(C_STRING_WITH_LEN("NO"), scs); + table->field[2]->store(plug->descr, strlen(plug->descr), scs); + if (schema_table_store_record(thd, table)) + DBUG_RETURN(1); + } + DBUG_RETURN(0); + } + if (!(hton->flags & HTON_HIDDEN)) { LEX_STRING *name= plugin_name(plugin); @@ -3950,10 +3972,13 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, strlen(plugin_decl(plugin)->descr), scs); tmp= &yesno[test(hton->commit)]; table->field[3]->store(tmp->str, tmp->length, scs); + table->field[3]->set_notnull(); tmp= &yesno[test(hton->prepare)]; table->field[4]->store(tmp->str, tmp->length, scs); + table->field[4]->set_notnull(); tmp= &yesno[test(hton->savepoint_set)]; table->field[5]->store(tmp->str, tmp->length, scs); + table->field[5]->set_notnull(); if (schema_table_store_record(thd, table)) DBUG_RETURN(1); @@ -3964,8 +3989,12 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond) { - return plugin_foreach(thd, iter_schema_engines, - MYSQL_STORAGE_ENGINE_PLUGIN, tables->table); + DBUG_ENTER("fill_schema_engines"); + if (plugin_foreach_with_mask(thd, iter_schema_engines, + MYSQL_STORAGE_ENGINE_PLUGIN, + ~PLUGIN_IS_FREED, tables->table)) + DBUG_RETURN(1); + DBUG_RETURN(0); } @@ -6162,9 +6191,9 @@ ST_FIELD_INFO engines_fields_info[]= {"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine", SKIP_OPEN_TABLE}, {"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support", SKIP_OPEN_TABLE}, {"COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN_TABLE}, - {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 0, "Transactions", SKIP_OPEN_TABLE}, - {"XA", 3, MYSQL_TYPE_STRING, 0, 0, "XA", SKIP_OPEN_TABLE}, - {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 0, "Savepoints", SKIP_OPEN_TABLE}, + {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 1, "Transactions", SKIP_OPEN_TABLE}, + {"XA", 3, MYSQL_TYPE_STRING, 0, 1, "XA", SKIP_OPEN_TABLE}, + {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 1, "Savepoints", SKIP_OPEN_TABLE}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; -- cgit v1.2.1 From 3f85c7f2702f1b25fcb9ea734d716bf9c885925e Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Fri, 19 Dec 2008 01:28:51 +0100 Subject: Disable part of innodb-autoinc.test, because the MySQL server asserts when compiled --with-debug, due to bug 39828, "autoinc wraps around when offset and increment > 1". This change should be reverted when that bug is fixed (and a a few other minor changes to the test as described in comments). --- mysql-test/r/innodb-autoinc.result | 12 +++++------- mysql-test/t/innodb-autoinc.test | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/innodb-autoinc.result b/mysql-test/r/innodb-autoinc.result index 589bf2f30b0..1e4b088c6cd 100644 --- a/mysql-test/r/innodb-autoinc.result +++ b/mysql-test/r/innodb-autoinc.result @@ -471,10 +471,9 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 2 auto_increment_offset 10 -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); SELECT * FROM t1; c1 -0 1 18446744073709551603 18446744073709551604 @@ -505,12 +504,13 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 5 auto_increment_offset 7 -INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -Got one of the listed errors +INSERT INTO t1 VALUES (NULL),(NULL); SELECT * FROM t1; c1 1 18446744073709551603 +18446744073709551607 +18446744073709551612 DROP TABLE t1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@INSERT_ID=1; @@ -572,12 +572,10 @@ SHOW VARIABLES LIKE "%auto_inc%"; Variable_name Value auto_increment_increment 65535 auto_increment_offset 65535 -INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +INSERT INTO t1 VALUES (NULL); SELECT * FROM t1; c1 1 -65534 -65535 18446744073709551610 18446744073709551615 DROP TABLE t1; diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index 172913349db..021e67e699f 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -302,7 +302,18 @@ SHOW VARIABLES LIKE "%auto_inc%"; # This should fail because of overflow but it doesn't, it seems to be # a MySQL server bug. It wraps around to 0 for the last value. # See MySQL Bug# 39828 -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +# +# Instead of wrapping around, it asserts when MySQL is compiled --with-debug +# (see sql/handler.cc:handler::update_auto_increment()). Don't test for +# overflow until Bug #39828 is fixed. +# +# Since this asserts when compiled --with-debug, we can't properly test this +# until Bug #39828 is fixed. For now, this test is meaningless. +#if Bug #39828 is fixed +#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +#else +INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); +#endif SELECT * FROM t1; DROP TABLE t1; @@ -324,8 +335,16 @@ SHOW VARIABLES LIKE "%auto_inc%"; # a duplicate entry message because of a MySQL server bug, it wraps # around. See MySQL Bug# 39828, once MySQL fix the bug we can replace # the ER_DUP_ENTRY, 1062 below with the appropriate error message --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +# +# Since this asserts when compiled --with-debug, we can't properly test this +# until Bug #39828 is fixed. For now, this test is meaningless. +#if Bug #39828 is fixed +# Still need to fix this error code, error should mention overflow +#-- error ER_DUP_ENTRY,1062 +#INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +#else +INSERT INTO t1 VALUES (NULL),(NULL); +#endif SELECT * FROM t1; DROP TABLE t1; @@ -368,6 +387,14 @@ SHOW VARIABLES LIKE "%auto_inc%"; # See MySQL Bug# 39828, once MySQL fix the bug we can enable the error # code expected test. # -- error ER_AUTOINC_READ_FAILED,1467 -INSERT INTO t1 VALUES (NULL),(NULL), (NULL); +# +# Since this asserts when compiled --with-debug, we can't properly test this +# until Bug #39828 is fixed. For now, this test is meaningless. +#if Bug #39828 is fixed +#-- error ER_AUTOINC_READ_FAILED,1467 +#INSERT INTO t1 VALUES (NULL),(NULL); +#else +INSERT INTO t1 VALUES (NULL); +#endif SELECT * FROM t1; DROP TABLE t1; -- cgit v1.2.1 From dc9c5440e357b1afde67ea43ad3e626835e55896 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 19 Dec 2008 09:23:15 +0100 Subject: Bug#36312: InnoDB DATA_FREE BUG? Problem is that DATA_FREE in SHOW TABLE STATUS is not correct when not using innodb_file_per_table. The solution is to use I_S.PARTITIONS instead. This is only a small fix for correcting mean record length and always return 0 if the table is empty. sql/ha_partition.cc: Bug#36312: InnoDB DATA_FREE BUG? This is only a small fix for correcting mean record length and always return 0 if the table is empty. --- sql/ha_partition.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 47d2d36ac8d..c8b068ca2be 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4815,7 +4815,7 @@ int ha_partition::info(uint flag) /* Calculates statistical variables records: Estimate of number records in table - We report sum (always at least 2) + We report sum (always at least 2 if not empty) deleted: Estimate of number holes in the table due to deletes We report sum @@ -4854,13 +4854,13 @@ int ha_partition::info(uint flag) stats.check_time= file->stats.check_time; } } while (*(++file_array)); - if (stats.records < 2 && + if (stats.records && stats.records < 2 && !(m_file[0]->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT)) stats.records= 2; if (stats.records > 0) stats.mean_rec_length= (ulong) (stats.data_file_length / stats.records); else - stats.mean_rec_length= 1; //? What should we set here + stats.mean_rec_length= 0; } if (flag & HA_STATUS_CONST) { -- cgit v1.2.1 From b4c40ac240c224f7a56be8486dcb6c34ec45b79b Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 19 Dec 2008 08:47:28 -0200 Subject: Bug#41612: resolve_stack_dump does not decode 5.1 stack trace resolve_stack_dump is not able to decode a stack trace produced by glibc's backtrace() functions. The problem is that the stack trace addresses are printed between brackets and the utility is not able to ignore the brackets. The solution is to modify resolve_stack_dump so it can recognize stack trace addresses surrounded by brackets. e.g. [0xdeadbeef]. extra/resolve_stack_dump.c: Skip to after a bracket if one is present in the input. --- extra/resolve_stack_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 5606c17ecf3..447d63890bd 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -290,7 +290,8 @@ static void do_resolve() char buf[1024], *p; while (fgets(buf, sizeof(buf), fp_dump)) { - p = buf; + /* skip bracket */ + p= (p= strchr(buf, '[')) ? p+1 : buf; /* skip space */ while (my_isspace(&my_charset_latin1,*p)) ++p; -- cgit v1.2.1 From 7976735a0c34a35a7f726a2e985f53582db09282 Mon Sep 17 00:00:00 2001 From: Sergey Petrunia Date: Fri, 19 Dec 2008 16:38:39 +0300 Subject: BUG#40974: Incorrect query results when using clause evaluated using range check - QUICK_INDEX_MERGE_SELECT deinitializes its rnd_pos() scan when it reaches EOF, but we need to make the deinitialization in QUICK_INDEX_MERGE_SELECT destructor also. This is because certain execution strategies can stop scanning without reaching EOF, then then try to do a full table scan on this table. Failure to deinitialize caused the full scan to use (already empty) table->sort and produce zero records. mysql-test/r/index_merge.result: BUG#40974: Incorrect query results when using clause evaluated using range check - Testcase mysql-test/t/index_merge.test: BUG#40974: Incorrect query results when using clause evaluated using range check - Testcase --- mysql-test/r/index_merge.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/index_merge.test | 26 ++++++++++++++++++++++++++ sql/opt_range.cc | 3 +++ 3 files changed, 57 insertions(+) diff --git a/mysql-test/r/index_merge.result b/mysql-test/r/index_merge.result index ed397e8fdc8..f3fce29c910 100644 --- a/mysql-test/r/index_merge.result +++ b/mysql-test/r/index_merge.result @@ -527,4 +527,32 @@ b a y z DROP TABLE t1; +# +# BUG#40974: Incorrect query results when using clause evaluated using range check +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int); +insert into t1 values (1),(2); +create table t2(a int, b int); +insert into t2 values (1,1), (2, 1000); +create table t3 (a int, b int, filler char(100), key(a), key(b)); +insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C; +insert into t3 values (1,1,'data'); +insert into t3 values (1,1,'data'); +The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) +explain select * from t1 +where exists (select 1 from t2, t3 +where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 ALL a,b NULL NULL NULL 1002 Range checked for each record (index map: 0x3) +select * from t1 +where exists (select 1 from t2, t3 +where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); +a +1 +2 +drop table t0, t1, t2, t3; End of 5.0 tests diff --git a/mysql-test/t/index_merge.test b/mysql-test/t/index_merge.test index 970b9a87454..7f176a4cd11 100644 --- a/mysql-test/t/index_merge.test +++ b/mysql-test/t/index_merge.test @@ -477,4 +477,30 @@ SELECT b,a from t1 WHERE (b!='c' AND b!='f' && b!='h') OR DROP TABLE t1; +--echo # +--echo # BUG#40974: Incorrect query results when using clause evaluated using range check +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (a int); +insert into t1 values (1),(2); +create table t2(a int, b int); +insert into t2 values (1,1), (2, 1000); +create table t3 (a int, b int, filler char(100), key(a), key(b)); + +insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C; +insert into t3 values (1,1,'data'); +insert into t3 values (1,1,'data'); +-- echo The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) +explain select * from t1 +where exists (select 1 from t2, t3 + where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); + +select * from t1 +where exists (select 1 from t2, t3 + where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); + +drop table t0, t1, t2, t3; + --echo End of 5.0 tests diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 204ebdb6f33..744415fa2fe 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1109,6 +1109,9 @@ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT() quick->file= NULL; quick_selects.delete_elements(); delete pk_quick_select; + /* It's ok to call the next two even if they are already deinitialized */ + end_read_record(&read_record); + free_io_cache(head); free_root(&alloc,MYF(0)); DBUG_VOID_RETURN; } -- cgit v1.2.1 From c06df92af647e67731cb3a76bd91d57219407f01 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 23 Dec 2008 18:08:04 +0400 Subject: Bug#37575 UCASE fails on monthname The MONTHNAME/DAYNAME functions returns binary string, so the LOWER/UPPER functions are not effective on the result of MONTHNAME/DAYNAME call. Character set of the MONTHNAME/DAYNAME function result has been changed to connection character set. include/m_ctype.h: added my_charset_repertoire function mysql-test/r/ctype_ucs.result: test result mysql-test/r/func_time.result: test result mysql-test/t/ctype_ucs.test: test case mysql-test/t/func_time.test: test case sql/item_timefunc.cc: Item_func_monthname::fix_length_and_dec and Item_func_dayname::fix_length_and_dec methods have been modified to use connection character set sql/item_timefunc.h: Item_func_monthname::fix_length_and_dec and Item_func_dayname::fix_length_and_dec methods have been modified to use connection character set sql/mysql_priv.h: added max_month_name_length, max_day_name_length fields into MY_LOCALE struct sql/mysqld.cc: The test_lc_time_sz function controls modifications of the locale database in debugging mode. sql/sql_locale.cc: initialization of max_month_name_length, max_day_name_length fields strings/ctype.c: added my_charset_repertoire function --- include/m_ctype.h | 1 + mysql-test/r/ctype_ucs.result | 53 +++++ mysql-test/r/func_time.result | 15 ++ mysql-test/t/ctype_ucs.test | 25 +++ mysql-test/t/func_time.test | 9 + sql/item_timefunc.cc | 41 +++- sql/item_timefunc.h | 18 +- sql/mysql_priv.h | 9 +- sql/mysqld.cc | 42 ++++ sql/sql_locale.cc | 436 +++++++++++++++++++++++++++++++----------- strings/ctype.c | 10 + 11 files changed, 527 insertions(+), 132 deletions(-) diff --git a/include/m_ctype.h b/include/m_ctype.h index 218ec2daadb..007edaf7740 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -445,6 +445,7 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len); uint my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong len); my_bool my_charset_is_ascii_based(CHARSET_INFO *cs); my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs); +uint my_charset_repertoire(CHARSET_INFO *cs); #define _MY_U 01 /* Upper case */ diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 89e8f1f6221..8c0f1a108a6 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -1111,4 +1111,57 @@ set names latin1; select hex(char(0x41 using ucs2)); hex(char(0x41 using ucs2)) 0041 +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +CHARSET(DAYNAME(19700101)) +ucs2 +SELECT CHARSET(MONTHNAME(19700101)); +CHARSET(MONTHNAME(19700101)) +ucs2 +SELECT LOWER(DAYNAME(19700101)); +LOWER(DAYNAME(19700101)) +thursday +SELECT LOWER(MONTHNAME(19700101)); +LOWER(MONTHNAME(19700101)) +january +SELECT UPPER(DAYNAME(19700101)); +UPPER(DAYNAME(19700101)) +THURSDAY +SELECT UPPER(MONTHNAME(19700101)); +UPPER(MONTHNAME(19700101)) +JANUARY +SELECT HEX(MONTHNAME(19700101)); +HEX(MONTHNAME(19700101)) +004A0061006E0075006100720079 +SELECT HEX(DAYNAME(19700101)); +HEX(DAYNAME(19700101)) +00540068007500720073006400610079 +SET LC_TIME_NAMES=ru_RU; +SET NAMES utf8; +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +CHARSET(DAYNAME(19700101)) +ucs2 +SELECT CHARSET(MONTHNAME(19700101)); +CHARSET(MONTHNAME(19700101)) +ucs2 +SELECT LOWER(DAYNAME(19700101)); +LOWER(DAYNAME(19700101)) +четверг +SELECT LOWER(MONTHNAME(19700101)); +LOWER(MONTHNAME(19700101)) +января +SELECT UPPER(DAYNAME(19700101)); +UPPER(DAYNAME(19700101)) +ЧЕТВЕРГ +SELECT UPPER(MONTHNAME(19700101)); +UPPER(MONTHNAME(19700101)) +ЯНВАРЯ +SELECT HEX(MONTHNAME(19700101)); +HEX(MONTHNAME(19700101)) +042F043D043204300440044F +SELECT HEX(DAYNAME(19700101)); +HEX(DAYNAME(19700101)) +0427043504420432043504400433 +SET character_set_connection=latin1; End of 5.0 tests diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index d397947d7ca..b3505795494 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -592,6 +592,21 @@ unix_timestamp('1970-01-01 03:00:01') select unix_timestamp('2038-01-19 07:14:07'); unix_timestamp('2038-01-19 07:14:07') 0 +SELECT CHARSET(DAYNAME(19700101)); +CHARSET(DAYNAME(19700101)) +latin1 +SELECT CHARSET(MONTHNAME(19700101)); +CHARSET(MONTHNAME(19700101)) +latin1 +SELECT LOWER(DAYNAME(19700101)); +LOWER(DAYNAME(19700101)) +thursday +SELECT LOWER(MONTHNAME(19700101)); +LOWER(MONTHNAME(19700101)) +january +SELECT COERCIBILITY(MONTHNAME('1970-01-01')),COERCIBILITY(DAYNAME('1970-01-01')); +COERCIBILITY(MONTHNAME('1970-01-01')) COERCIBILITY(DAYNAME('1970-01-01')) +4 4 CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time); INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08"); SELECT * from t1; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 854a2fa3c5e..715b74dd2a8 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -685,4 +685,29 @@ set names latin1; # select hex(char(0x41 using ucs2)); +# +# Bug#37575: UCASE fails on monthname +# +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +SELECT CHARSET(MONTHNAME(19700101)); +SELECT LOWER(DAYNAME(19700101)); +SELECT LOWER(MONTHNAME(19700101)); +SELECT UPPER(DAYNAME(19700101)); +SELECT UPPER(MONTHNAME(19700101)); +SELECT HEX(MONTHNAME(19700101)); +SELECT HEX(DAYNAME(19700101)); +SET LC_TIME_NAMES=ru_RU; +SET NAMES utf8; +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +SELECT CHARSET(MONTHNAME(19700101)); +SELECT LOWER(DAYNAME(19700101)); +SELECT LOWER(MONTHNAME(19700101)); +SELECT UPPER(DAYNAME(19700101)); +SELECT UPPER(MONTHNAME(19700101)); +SELECT HEX(MONTHNAME(19700101)); +SELECT HEX(DAYNAME(19700101)); +SET character_set_connection=latin1; + --echo End of 5.0 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index ef22adb4251..65d8764f2ce 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -304,6 +304,15 @@ select unix_timestamp('1970-01-01 03:00:01'); # check bad date, close to the boundary (we cut them off in the very end) select unix_timestamp('2038-01-19 07:14:07'); +# +# Bug #28759: DAYNAME() and MONTHNAME() return binary string +# + +SELECT CHARSET(DAYNAME(19700101)); +SELECT CHARSET(MONTHNAME(19700101)); +SELECT LOWER(DAYNAME(19700101)); +SELECT LOWER(MONTHNAME(19700101)); +SELECT COERCIBILITY(MONTHNAME('1970-01-01')),COERCIBILITY(DAYNAME('1970-01-01')); # # Test types from + INTERVAL diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index e9e92952908..38d9d62bd99 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1036,12 +1036,25 @@ longlong Item_func_month::val_int() } +void Item_func_monthname::fix_length_and_dec() +{ + THD* thd= current_thd; + CHARSET_INFO *cs= thd->variables.collation_connection; + uint32 repertoire= my_charset_repertoire(cs); + locale= thd->variables.lc_time_names; + collation.set(cs, DERIVATION_COERCIBLE, repertoire); + decimals=0; + max_length= locale->max_month_name_length * collation.collation->mbmaxlen; + maybe_null=1; +} + + String* Item_func_monthname::val_str(String* str) { DBUG_ASSERT(fixed == 1); const char *month_name; - uint month= (uint) val_int(); - THD *thd= current_thd; + uint month= (uint) val_int(); + uint err; if (null_value || !month) { @@ -1049,8 +1062,9 @@ String* Item_func_monthname::val_str(String* str) return (String*) 0; } null_value=0; - month_name= thd->variables.lc_time_names->month_names->type_names[month-1]; - str->set(month_name, strlen(month_name), system_charset_info); + month_name= locale->month_names->type_names[month-1]; + str->copy(month_name, strlen(month_name), &my_charset_utf8_bin, + collation.collation, &err); return str; } @@ -1169,19 +1183,32 @@ longlong Item_func_weekday::val_int() odbc_type) + test(odbc_type); } +void Item_func_dayname::fix_length_and_dec() +{ + THD* thd= current_thd; + CHARSET_INFO *cs= thd->variables.collation_connection; + uint32 repertoire= my_charset_repertoire(cs); + locale= thd->variables.lc_time_names; + collation.set(cs, DERIVATION_COERCIBLE, repertoire); + decimals=0; + max_length= locale->max_day_name_length * collation.collation->mbmaxlen; + maybe_null=1; +} + String* Item_func_dayname::val_str(String* str) { DBUG_ASSERT(fixed == 1); uint weekday=(uint) val_int(); // Always Item_func_daynr() const char *day_name; - THD *thd= current_thd; + uint err; if (null_value) return (String*) 0; - day_name= thd->variables.lc_time_names->day_names->type_names[weekday]; - str->set(day_name, strlen(day_name), system_charset_info); + day_name= locale->day_names->type_names[weekday]; + str->copy(day_name, strlen(day_name), &my_charset_utf8_bin, + collation.collation, &err); return str; } diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 81a6c3e98bd..161a77f60b4 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -108,18 +108,13 @@ public: class Item_func_monthname :public Item_func_month { + MY_LOCALE *locale; public: Item_func_monthname(Item *a) :Item_func_month(a) {} const char *func_name() const { return "monthname"; } String *val_str(String *str); enum Item_result result_type () const { return STRING_RESULT; } - void fix_length_and_dec() - { - collation.set(&my_charset_bin); - decimals=0; - max_length=10*my_charset_bin.mbmaxlen; - maybe_null=1; - } + void fix_length_and_dec(); }; @@ -272,18 +267,13 @@ public: class Item_func_dayname :public Item_func_weekday { + MY_LOCALE *locale; public: Item_func_dayname(Item *a) :Item_func_weekday(a,0) {} const char *func_name() const { return "dayname"; } String *val_str(String *str); enum Item_result result_type () const { return STRING_RESULT; } - void fix_length_and_dec() - { - collation.set(&my_charset_bin); - decimals=0; - max_length=9*MY_CHARSET_BIN_MB_MAXLEN; - maybe_null=1; - } + void fix_length_and_dec(); }; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 520d97b5e9f..a06a7e7d6e3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -132,15 +132,20 @@ typedef struct my_locale_st TYPELIB *ab_month_names; TYPELIB *day_names; TYPELIB *ab_day_names; + uint max_month_name_length; + uint max_day_name_length; #ifdef __cplusplus my_locale_st(uint number_par, const char *name_par, const char *descr_par, bool is_ascii_par, TYPELIB *month_names_par, TYPELIB *ab_month_names_par, - TYPELIB *day_names_par, TYPELIB *ab_day_names_par) : + TYPELIB *day_names_par, TYPELIB *ab_day_names_par, + uint max_month_name_length_par, uint max_day_name_length_par) : number(number_par), name(name_par), description(descr_par), is_ascii(is_ascii_par), month_names(month_names_par), ab_month_names(ab_month_names_par), - day_names(day_names_par), ab_day_names(ab_day_names_par) + day_names(day_names_par), ab_day_names(ab_day_names_par), + max_month_name_length(max_month_name_length_par), + max_day_name_length(max_day_name_length_par) {} #endif } MY_LOCALE; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8232cefc880..f5e5b881a37 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3616,6 +3616,44 @@ void decrement_handler_count() #endif /* defined(__NT__) || defined(HAVE_SMEM) */ +#ifndef DBUG_OFF +/* + Debugging helper function to keep the locale database + (see sql_locale.cc) and max_month_name_length and + max_day_name_length variable values in consistent state. +*/ +static void test_lc_time_sz() +{ + DBUG_ENTER("test_lc_time_sz"); + for (MY_LOCALE **loc= my_locales; *loc; loc++) + { + uint max_month_len= 0; + uint max_day_len = 0; + for (const char **month= (*loc)->month_names->type_names; *month; month++) + { + set_if_bigger(max_month_len, + my_numchars_mb(&my_charset_utf8_general_ci, + *month, *month + strlen(*month))); + } + for (const char **day= (*loc)->day_names->type_names; *day; day++) + { + set_if_bigger(max_day_len, + my_numchars_mb(&my_charset_utf8_general_ci, + *day, *day + strlen(*day))); + } + if ((*loc)->max_month_name_length != max_month_len || + (*loc)->max_day_name_length != max_day_len) + { + DBUG_PRINT("Wrong max day name(or month name) length for locale:", + ("%s", (*loc)->name)); + DBUG_ASSERT(0); + } + } + DBUG_VOID_RETURN; +} +#endif//DBUG_OFF + + #ifndef EMBEDDED_LIBRARY #ifdef __WIN__ int win_main(int argc, char **argv) @@ -3712,6 +3750,10 @@ int main(int argc, char **argv) openlog(libwrapName, LOG_PID, LOG_AUTH); #endif +#ifndef DBUG_OFF + test_lc_time_sz(); +#endif + /* We have enough space for fiddling with the argv, continue */ diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index 4e61c664106..3def9864c29 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -49,7 +49,9 @@ MY_LOCALE my_locale_ar_AE &my_locale_typelib_month_names_ar_AE, &my_locale_typelib_ab_month_names_ar_AE, &my_locale_typelib_day_names_ar_AE, - &my_locale_typelib_ab_day_names_ar_AE + &my_locale_typelib_ab_day_names_ar_AE, + 6, + 8 ); /***** LOCALE END ar_AE *****/ @@ -79,7 +81,9 @@ MY_LOCALE my_locale_ar_BH &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_BH *****/ @@ -109,7 +113,9 @@ MY_LOCALE my_locale_ar_JO &my_locale_typelib_month_names_ar_JO, &my_locale_typelib_ab_month_names_ar_JO, &my_locale_typelib_day_names_ar_JO, - &my_locale_typelib_ab_day_names_ar_JO + &my_locale_typelib_ab_day_names_ar_JO, + 12, + 8 ); /***** LOCALE END ar_JO *****/ @@ -139,7 +145,9 @@ MY_LOCALE my_locale_ar_SA &my_locale_typelib_month_names_ar_SA, &my_locale_typelib_ab_month_names_ar_SA, &my_locale_typelib_day_names_ar_SA, - &my_locale_typelib_ab_day_names_ar_SA + &my_locale_typelib_ab_day_names_ar_SA, + 12, + 8 ); /***** LOCALE END ar_SA *****/ @@ -169,7 +177,9 @@ MY_LOCALE my_locale_ar_SY &my_locale_typelib_month_names_ar_SY, &my_locale_typelib_ab_month_names_ar_SY, &my_locale_typelib_day_names_ar_SY, - &my_locale_typelib_ab_day_names_ar_SY + &my_locale_typelib_ab_day_names_ar_SY, + 12, + 8 ); /***** LOCALE END ar_SY *****/ @@ -199,7 +209,9 @@ MY_LOCALE my_locale_be_BY &my_locale_typelib_month_names_be_BY, &my_locale_typelib_ab_month_names_be_BY, &my_locale_typelib_day_names_be_BY, - &my_locale_typelib_ab_day_names_be_BY + &my_locale_typelib_ab_day_names_be_BY, + 10, + 10 ); /***** LOCALE END be_BY *****/ @@ -229,7 +241,9 @@ MY_LOCALE my_locale_bg_BG &my_locale_typelib_month_names_bg_BG, &my_locale_typelib_ab_month_names_bg_BG, &my_locale_typelib_day_names_bg_BG, - &my_locale_typelib_ab_day_names_bg_BG + &my_locale_typelib_ab_day_names_bg_BG, + 9, + 10 ); /***** LOCALE END bg_BG *****/ @@ -259,7 +273,9 @@ MY_LOCALE my_locale_ca_ES &my_locale_typelib_month_names_ca_ES, &my_locale_typelib_ab_month_names_ca_ES, &my_locale_typelib_day_names_ca_ES, - &my_locale_typelib_ab_day_names_ca_ES + &my_locale_typelib_ab_day_names_ca_ES, + 8, + 9 ); /***** LOCALE END ca_ES *****/ @@ -289,7 +305,9 @@ MY_LOCALE my_locale_cs_CZ &my_locale_typelib_month_names_cs_CZ, &my_locale_typelib_ab_month_names_cs_CZ, &my_locale_typelib_day_names_cs_CZ, - &my_locale_typelib_ab_day_names_cs_CZ + &my_locale_typelib_ab_day_names_cs_CZ, + 8, + 7 ); /***** LOCALE END cs_CZ *****/ @@ -319,7 +337,9 @@ MY_LOCALE my_locale_da_DK &my_locale_typelib_month_names_da_DK, &my_locale_typelib_ab_month_names_da_DK, &my_locale_typelib_day_names_da_DK, - &my_locale_typelib_ab_day_names_da_DK + &my_locale_typelib_ab_day_names_da_DK, + 9, + 7 ); /***** LOCALE END da_DK *****/ @@ -349,7 +369,9 @@ MY_LOCALE my_locale_de_AT &my_locale_typelib_month_names_de_AT, &my_locale_typelib_ab_month_names_de_AT, &my_locale_typelib_day_names_de_AT, - &my_locale_typelib_ab_day_names_de_AT + &my_locale_typelib_ab_day_names_de_AT, + 9, + 10 ); /***** LOCALE END de_AT *****/ @@ -379,7 +401,9 @@ MY_LOCALE my_locale_de_DE &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, - &my_locale_typelib_ab_day_names_de_DE + &my_locale_typelib_ab_day_names_de_DE, + 9, + 10 ); /***** LOCALE END de_DE *****/ @@ -409,7 +433,9 @@ MY_LOCALE my_locale_en_US &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_US *****/ @@ -439,7 +465,9 @@ MY_LOCALE my_locale_es_ES &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_ES *****/ @@ -469,7 +497,9 @@ MY_LOCALE my_locale_et_EE &my_locale_typelib_month_names_et_EE, &my_locale_typelib_ab_month_names_et_EE, &my_locale_typelib_day_names_et_EE, - &my_locale_typelib_ab_day_names_et_EE + &my_locale_typelib_ab_day_names_et_EE, + 9, + 9 ); /***** LOCALE END et_EE *****/ @@ -499,7 +529,9 @@ MY_LOCALE my_locale_eu_ES &my_locale_typelib_month_names_eu_ES, &my_locale_typelib_ab_month_names_eu_ES, &my_locale_typelib_day_names_eu_ES, - &my_locale_typelib_ab_day_names_eu_ES + &my_locale_typelib_ab_day_names_eu_ES, + 9, + 10 ); /***** LOCALE END eu_ES *****/ @@ -529,7 +561,9 @@ MY_LOCALE my_locale_fi_FI &my_locale_typelib_month_names_fi_FI, &my_locale_typelib_ab_month_names_fi_FI, &my_locale_typelib_day_names_fi_FI, - &my_locale_typelib_ab_day_names_fi_FI + &my_locale_typelib_ab_day_names_fi_FI, + 9, + 11 ); /***** LOCALE END fi_FI *****/ @@ -559,7 +593,9 @@ MY_LOCALE my_locale_fo_FO &my_locale_typelib_month_names_fo_FO, &my_locale_typelib_ab_month_names_fo_FO, &my_locale_typelib_day_names_fo_FO, - &my_locale_typelib_ab_day_names_fo_FO + &my_locale_typelib_ab_day_names_fo_FO, + 9, + 12 ); /***** LOCALE END fo_FO *****/ @@ -589,7 +625,9 @@ MY_LOCALE my_locale_fr_FR &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_FR *****/ @@ -619,7 +657,9 @@ MY_LOCALE my_locale_gl_ES &my_locale_typelib_month_names_gl_ES, &my_locale_typelib_ab_month_names_gl_ES, &my_locale_typelib_day_names_gl_ES, - &my_locale_typelib_ab_day_names_gl_ES + &my_locale_typelib_ab_day_names_gl_ES, + 8, + 8 ); /***** LOCALE END gl_ES *****/ @@ -649,7 +689,9 @@ MY_LOCALE my_locale_gu_IN &my_locale_typelib_month_names_gu_IN, &my_locale_typelib_ab_month_names_gu_IN, &my_locale_typelib_day_names_gu_IN, - &my_locale_typelib_ab_day_names_gu_IN + &my_locale_typelib_ab_day_names_gu_IN, + 10, + 8 ); /***** LOCALE END gu_IN *****/ @@ -679,7 +721,9 @@ MY_LOCALE my_locale_he_IL &my_locale_typelib_month_names_he_IL, &my_locale_typelib_ab_month_names_he_IL, &my_locale_typelib_day_names_he_IL, - &my_locale_typelib_ab_day_names_he_IL + &my_locale_typelib_ab_day_names_he_IL, + 7, + 5 ); /***** LOCALE END he_IL *****/ @@ -709,7 +753,9 @@ MY_LOCALE my_locale_hi_IN &my_locale_typelib_month_names_hi_IN, &my_locale_typelib_ab_month_names_hi_IN, &my_locale_typelib_day_names_hi_IN, - &my_locale_typelib_ab_day_names_hi_IN + &my_locale_typelib_ab_day_names_hi_IN, + 7, + 9 ); /***** LOCALE END hi_IN *****/ @@ -739,7 +785,9 @@ MY_LOCALE my_locale_hr_HR &my_locale_typelib_month_names_hr_HR, &my_locale_typelib_ab_month_names_hr_HR, &my_locale_typelib_day_names_hr_HR, - &my_locale_typelib_ab_day_names_hr_HR + &my_locale_typelib_ab_day_names_hr_HR, + 8, + 11 ); /***** LOCALE END hr_HR *****/ @@ -769,7 +817,9 @@ MY_LOCALE my_locale_hu_HU &my_locale_typelib_month_names_hu_HU, &my_locale_typelib_ab_month_names_hu_HU, &my_locale_typelib_day_names_hu_HU, - &my_locale_typelib_ab_day_names_hu_HU + &my_locale_typelib_ab_day_names_hu_HU, + 10, + 9 ); /***** LOCALE END hu_HU *****/ @@ -799,7 +849,9 @@ MY_LOCALE my_locale_id_ID &my_locale_typelib_month_names_id_ID, &my_locale_typelib_ab_month_names_id_ID, &my_locale_typelib_day_names_id_ID, - &my_locale_typelib_ab_day_names_id_ID + &my_locale_typelib_ab_day_names_id_ID, + 9, + 6 ); /***** LOCALE END id_ID *****/ @@ -829,7 +881,9 @@ MY_LOCALE my_locale_is_IS &my_locale_typelib_month_names_is_IS, &my_locale_typelib_ab_month_names_is_IS, &my_locale_typelib_day_names_is_IS, - &my_locale_typelib_ab_day_names_is_IS + &my_locale_typelib_ab_day_names_is_IS, + 9, + 12 ); /***** LOCALE END is_IS *****/ @@ -859,7 +913,9 @@ MY_LOCALE my_locale_it_CH &my_locale_typelib_month_names_it_CH, &my_locale_typelib_ab_month_names_it_CH, &my_locale_typelib_day_names_it_CH, - &my_locale_typelib_ab_day_names_it_CH + &my_locale_typelib_ab_day_names_it_CH, + 9, + 9 ); /***** LOCALE END it_CH *****/ @@ -889,7 +945,9 @@ MY_LOCALE my_locale_ja_JP &my_locale_typelib_month_names_ja_JP, &my_locale_typelib_ab_month_names_ja_JP, &my_locale_typelib_day_names_ja_JP, - &my_locale_typelib_ab_day_names_ja_JP + &my_locale_typelib_ab_day_names_ja_JP, + 3, + 3 ); /***** LOCALE END ja_JP *****/ @@ -919,7 +977,9 @@ MY_LOCALE my_locale_ko_KR &my_locale_typelib_month_names_ko_KR, &my_locale_typelib_ab_month_names_ko_KR, &my_locale_typelib_day_names_ko_KR, - &my_locale_typelib_ab_day_names_ko_KR + &my_locale_typelib_ab_day_names_ko_KR, + 3, + 3 ); /***** LOCALE END ko_KR *****/ @@ -949,7 +1009,9 @@ MY_LOCALE my_locale_lt_LT &my_locale_typelib_month_names_lt_LT, &my_locale_typelib_ab_month_names_lt_LT, &my_locale_typelib_day_names_lt_LT, - &my_locale_typelib_ab_day_names_lt_LT + &my_locale_typelib_ab_day_names_lt_LT, + 9, + 14 ); /***** LOCALE END lt_LT *****/ @@ -979,7 +1041,9 @@ MY_LOCALE my_locale_lv_LV &my_locale_typelib_month_names_lv_LV, &my_locale_typelib_ab_month_names_lv_LV, &my_locale_typelib_day_names_lv_LV, - &my_locale_typelib_ab_day_names_lv_LV + &my_locale_typelib_ab_day_names_lv_LV, + 10, + 11 ); /***** LOCALE END lv_LV *****/ @@ -1009,7 +1073,9 @@ MY_LOCALE my_locale_mk_MK &my_locale_typelib_month_names_mk_MK, &my_locale_typelib_ab_month_names_mk_MK, &my_locale_typelib_day_names_mk_MK, - &my_locale_typelib_ab_day_names_mk_MK + &my_locale_typelib_ab_day_names_mk_MK, + 9, + 10 ); /***** LOCALE END mk_MK *****/ @@ -1039,7 +1105,9 @@ MY_LOCALE my_locale_mn_MN &my_locale_typelib_month_names_mn_MN, &my_locale_typelib_ab_month_names_mn_MN, &my_locale_typelib_day_names_mn_MN, - &my_locale_typelib_ab_day_names_mn_MN + &my_locale_typelib_ab_day_names_mn_MN, + 18, + 6 ); /***** LOCALE END mn_MN *****/ @@ -1069,7 +1137,9 @@ MY_LOCALE my_locale_ms_MY &my_locale_typelib_month_names_ms_MY, &my_locale_typelib_ab_month_names_ms_MY, &my_locale_typelib_day_names_ms_MY, - &my_locale_typelib_ab_day_names_ms_MY + &my_locale_typelib_ab_day_names_ms_MY, + 9, + 6 ); /***** LOCALE END ms_MY *****/ @@ -1099,7 +1169,9 @@ MY_LOCALE my_locale_nb_NO &my_locale_typelib_month_names_nb_NO, &my_locale_typelib_ab_month_names_nb_NO, &my_locale_typelib_day_names_nb_NO, - &my_locale_typelib_ab_day_names_nb_NO + &my_locale_typelib_ab_day_names_nb_NO, + 9, + 7 ); /***** LOCALE END nb_NO *****/ @@ -1129,7 +1201,9 @@ MY_LOCALE my_locale_nl_NL &my_locale_typelib_month_names_nl_NL, &my_locale_typelib_ab_month_names_nl_NL, &my_locale_typelib_day_names_nl_NL, - &my_locale_typelib_ab_day_names_nl_NL + &my_locale_typelib_ab_day_names_nl_NL, + 9, + 9 ); /***** LOCALE END nl_NL *****/ @@ -1159,7 +1233,9 @@ MY_LOCALE my_locale_pl_PL &my_locale_typelib_month_names_pl_PL, &my_locale_typelib_ab_month_names_pl_PL, &my_locale_typelib_day_names_pl_PL, - &my_locale_typelib_ab_day_names_pl_PL + &my_locale_typelib_ab_day_names_pl_PL, + 11, + 12 ); /***** LOCALE END pl_PL *****/ @@ -1189,7 +1265,9 @@ MY_LOCALE my_locale_pt_BR &my_locale_typelib_month_names_pt_BR, &my_locale_typelib_ab_month_names_pt_BR, &my_locale_typelib_day_names_pt_BR, - &my_locale_typelib_ab_day_names_pt_BR + &my_locale_typelib_ab_day_names_pt_BR, + 9, + 7 ); /***** LOCALE END pt_BR *****/ @@ -1219,7 +1297,9 @@ MY_LOCALE my_locale_pt_PT &my_locale_typelib_month_names_pt_PT, &my_locale_typelib_ab_month_names_pt_PT, &my_locale_typelib_day_names_pt_PT, - &my_locale_typelib_ab_day_names_pt_PT + &my_locale_typelib_ab_day_names_pt_PT, + 9, + 7 ); /***** LOCALE END pt_PT *****/ @@ -1249,7 +1329,9 @@ MY_LOCALE my_locale_ro_RO &my_locale_typelib_month_names_ro_RO, &my_locale_typelib_ab_month_names_ro_RO, &my_locale_typelib_day_names_ro_RO, - &my_locale_typelib_ab_day_names_ro_RO + &my_locale_typelib_ab_day_names_ro_RO, + 10, + 8 ); /***** LOCALE END ro_RO *****/ @@ -1279,7 +1361,9 @@ MY_LOCALE my_locale_ru_RU &my_locale_typelib_month_names_ru_RU, &my_locale_typelib_ab_month_names_ru_RU, &my_locale_typelib_day_names_ru_RU, - &my_locale_typelib_ab_day_names_ru_RU + &my_locale_typelib_ab_day_names_ru_RU, + 8, + 11 ); /***** LOCALE END ru_RU *****/ @@ -1309,7 +1393,9 @@ MY_LOCALE my_locale_ru_UA &my_locale_typelib_month_names_ru_UA, &my_locale_typelib_ab_month_names_ru_UA, &my_locale_typelib_day_names_ru_UA, - &my_locale_typelib_ab_day_names_ru_UA + &my_locale_typelib_ab_day_names_ru_UA, + 8, + 11 ); /***** LOCALE END ru_UA *****/ @@ -1339,7 +1425,9 @@ MY_LOCALE my_locale_sk_SK &my_locale_typelib_month_names_sk_SK, &my_locale_typelib_ab_month_names_sk_SK, &my_locale_typelib_day_names_sk_SK, - &my_locale_typelib_ab_day_names_sk_SK + &my_locale_typelib_ab_day_names_sk_SK, + 9, + 8 ); /***** LOCALE END sk_SK *****/ @@ -1369,7 +1457,9 @@ MY_LOCALE my_locale_sl_SI &my_locale_typelib_month_names_sl_SI, &my_locale_typelib_ab_month_names_sl_SI, &my_locale_typelib_day_names_sl_SI, - &my_locale_typelib_ab_day_names_sl_SI + &my_locale_typelib_ab_day_names_sl_SI, + 9, + 10 ); /***** LOCALE END sl_SI *****/ @@ -1399,7 +1489,9 @@ MY_LOCALE my_locale_sq_AL &my_locale_typelib_month_names_sq_AL, &my_locale_typelib_ab_month_names_sq_AL, &my_locale_typelib_day_names_sq_AL, - &my_locale_typelib_ab_day_names_sq_AL + &my_locale_typelib_ab_day_names_sq_AL, + 7, + 10 ); /***** LOCALE END sq_AL *****/ @@ -1429,7 +1521,9 @@ MY_LOCALE my_locale_sr_YU &my_locale_typelib_month_names_sr_YU, &my_locale_typelib_ab_month_names_sr_YU, &my_locale_typelib_day_names_sr_YU, - &my_locale_typelib_ab_day_names_sr_YU + &my_locale_typelib_ab_day_names_sr_YU, + 9, + 10 ); /***** LOCALE END sr_YU *****/ @@ -1459,7 +1553,9 @@ MY_LOCALE my_locale_sv_SE &my_locale_typelib_month_names_sv_SE, &my_locale_typelib_ab_month_names_sv_SE, &my_locale_typelib_day_names_sv_SE, - &my_locale_typelib_ab_day_names_sv_SE + &my_locale_typelib_ab_day_names_sv_SE, + 9, + 7 ); /***** LOCALE END sv_SE *****/ @@ -1489,7 +1585,9 @@ MY_LOCALE my_locale_ta_IN &my_locale_typelib_month_names_ta_IN, &my_locale_typelib_ab_month_names_ta_IN, &my_locale_typelib_day_names_ta_IN, - &my_locale_typelib_ab_day_names_ta_IN + &my_locale_typelib_ab_day_names_ta_IN, + 10, + 8 ); /***** LOCALE END ta_IN *****/ @@ -1519,7 +1617,9 @@ MY_LOCALE my_locale_te_IN &my_locale_typelib_month_names_te_IN, &my_locale_typelib_ab_month_names_te_IN, &my_locale_typelib_day_names_te_IN, - &my_locale_typelib_ab_day_names_te_IN + &my_locale_typelib_ab_day_names_te_IN, + 10, + 9 ); /***** LOCALE END te_IN *****/ @@ -1549,7 +1649,9 @@ MY_LOCALE my_locale_th_TH &my_locale_typelib_month_names_th_TH, &my_locale_typelib_ab_month_names_th_TH, &my_locale_typelib_day_names_th_TH, - &my_locale_typelib_ab_day_names_th_TH + &my_locale_typelib_ab_day_names_th_TH, + 10, + 8 ); /***** LOCALE END th_TH *****/ @@ -1579,7 +1681,9 @@ MY_LOCALE my_locale_tr_TR &my_locale_typelib_month_names_tr_TR, &my_locale_typelib_ab_month_names_tr_TR, &my_locale_typelib_day_names_tr_TR, - &my_locale_typelib_ab_day_names_tr_TR + &my_locale_typelib_ab_day_names_tr_TR, + 7, + 9 ); /***** LOCALE END tr_TR *****/ @@ -1609,7 +1713,9 @@ MY_LOCALE my_locale_uk_UA &my_locale_typelib_month_names_uk_UA, &my_locale_typelib_ab_month_names_uk_UA, &my_locale_typelib_day_names_uk_UA, - &my_locale_typelib_ab_day_names_uk_UA + &my_locale_typelib_ab_day_names_uk_UA, + 8, + 9 ); /***** LOCALE END uk_UA *****/ @@ -1639,7 +1745,9 @@ MY_LOCALE my_locale_ur_PK &my_locale_typelib_month_names_ur_PK, &my_locale_typelib_ab_month_names_ur_PK, &my_locale_typelib_day_names_ur_PK, - &my_locale_typelib_ab_day_names_ur_PK + &my_locale_typelib_ab_day_names_ur_PK, + 6, + 6 ); /***** LOCALE END ur_PK *****/ @@ -1669,7 +1777,9 @@ MY_LOCALE my_locale_vi_VN &my_locale_typelib_month_names_vi_VN, &my_locale_typelib_ab_month_names_vi_VN, &my_locale_typelib_day_names_vi_VN, - &my_locale_typelib_ab_day_names_vi_VN + &my_locale_typelib_ab_day_names_vi_VN, + 16, + 11 ); /***** LOCALE END vi_VN *****/ @@ -1699,7 +1809,9 @@ MY_LOCALE my_locale_zh_CN &my_locale_typelib_month_names_zh_CN, &my_locale_typelib_ab_month_names_zh_CN, &my_locale_typelib_day_names_zh_CN, - &my_locale_typelib_ab_day_names_zh_CN + &my_locale_typelib_ab_day_names_zh_CN, + 3, + 3 ); /***** LOCALE END zh_CN *****/ @@ -1729,7 +1841,9 @@ MY_LOCALE my_locale_zh_TW &my_locale_typelib_month_names_zh_TW, &my_locale_typelib_ab_month_names_zh_TW, &my_locale_typelib_day_names_zh_TW, - &my_locale_typelib_ab_day_names_zh_TW + &my_locale_typelib_ab_day_names_zh_TW, + 3, + 2 ); /***** LOCALE END zh_TW *****/ @@ -1743,7 +1857,9 @@ MY_LOCALE my_locale_ar_DZ &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_DZ *****/ @@ -1757,7 +1873,9 @@ MY_LOCALE my_locale_ar_EG &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_EG *****/ @@ -1771,7 +1889,9 @@ MY_LOCALE my_locale_ar_IN &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_IN *****/ @@ -1785,7 +1905,9 @@ MY_LOCALE my_locale_ar_IQ &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_IQ *****/ @@ -1799,7 +1921,9 @@ MY_LOCALE my_locale_ar_KW &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_KW *****/ @@ -1813,7 +1937,9 @@ MY_LOCALE my_locale_ar_LB &my_locale_typelib_month_names_ar_JO, &my_locale_typelib_ab_month_names_ar_JO, &my_locale_typelib_day_names_ar_JO, - &my_locale_typelib_ab_day_names_ar_JO + &my_locale_typelib_ab_day_names_ar_JO, + 12, + 8 ); /***** LOCALE END ar_LB *****/ @@ -1827,7 +1953,9 @@ MY_LOCALE my_locale_ar_LY &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_LY *****/ @@ -1841,7 +1969,9 @@ MY_LOCALE my_locale_ar_MA &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_MA *****/ @@ -1855,7 +1985,9 @@ MY_LOCALE my_locale_ar_OM &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_OM *****/ @@ -1869,7 +2001,9 @@ MY_LOCALE my_locale_ar_QA &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_QA *****/ @@ -1883,7 +2017,9 @@ MY_LOCALE my_locale_ar_SD &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_SD *****/ @@ -1897,7 +2033,9 @@ MY_LOCALE my_locale_ar_TN &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_TN *****/ @@ -1911,7 +2049,9 @@ MY_LOCALE my_locale_ar_YE &my_locale_typelib_month_names_ar_BH, &my_locale_typelib_ab_month_names_ar_BH, &my_locale_typelib_day_names_ar_BH, - &my_locale_typelib_ab_day_names_ar_BH + &my_locale_typelib_ab_day_names_ar_BH, + 6, + 8 ); /***** LOCALE END ar_YE *****/ @@ -1925,7 +2065,9 @@ MY_LOCALE my_locale_de_BE &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, - &my_locale_typelib_ab_day_names_de_DE + &my_locale_typelib_ab_day_names_de_DE, + 9, + 10 ); /***** LOCALE END de_BE *****/ @@ -1939,7 +2081,9 @@ MY_LOCALE my_locale_de_CH &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, - &my_locale_typelib_ab_day_names_de_DE + &my_locale_typelib_ab_day_names_de_DE, + 9, + 10 ); /***** LOCALE END de_CH *****/ @@ -1953,7 +2097,9 @@ MY_LOCALE my_locale_de_LU &my_locale_typelib_month_names_de_DE, &my_locale_typelib_ab_month_names_de_DE, &my_locale_typelib_day_names_de_DE, - &my_locale_typelib_ab_day_names_de_DE + &my_locale_typelib_ab_day_names_de_DE, + 9, + 10 ); /***** LOCALE END de_LU *****/ @@ -1967,7 +2113,9 @@ MY_LOCALE my_locale_en_AU &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_AU *****/ @@ -1981,7 +2129,9 @@ MY_LOCALE my_locale_en_CA &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_CA *****/ @@ -1995,7 +2145,9 @@ MY_LOCALE my_locale_en_GB &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_GB *****/ @@ -2009,7 +2161,9 @@ MY_LOCALE my_locale_en_IN &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_IN *****/ @@ -2023,7 +2177,9 @@ MY_LOCALE my_locale_en_NZ &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_NZ *****/ @@ -2037,7 +2193,9 @@ MY_LOCALE my_locale_en_PH &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_PH *****/ @@ -2051,7 +2209,9 @@ MY_LOCALE my_locale_en_ZA &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_ZA *****/ @@ -2065,7 +2225,9 @@ MY_LOCALE my_locale_en_ZW &my_locale_typelib_month_names_en_US, &my_locale_typelib_ab_month_names_en_US, &my_locale_typelib_day_names_en_US, - &my_locale_typelib_ab_day_names_en_US + &my_locale_typelib_ab_day_names_en_US, + 9, + 9 ); /***** LOCALE END en_ZW *****/ @@ -2079,7 +2241,9 @@ MY_LOCALE my_locale_es_AR &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_AR *****/ @@ -2093,7 +2257,9 @@ MY_LOCALE my_locale_es_BO &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_BO *****/ @@ -2107,7 +2273,9 @@ MY_LOCALE my_locale_es_CL &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_CL *****/ @@ -2121,7 +2289,9 @@ MY_LOCALE my_locale_es_CO &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_CO *****/ @@ -2135,7 +2305,9 @@ MY_LOCALE my_locale_es_CR &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_CR *****/ @@ -2149,7 +2321,9 @@ MY_LOCALE my_locale_es_DO &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_DO *****/ @@ -2163,7 +2337,9 @@ MY_LOCALE my_locale_es_EC &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_EC *****/ @@ -2177,7 +2353,9 @@ MY_LOCALE my_locale_es_GT &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_GT *****/ @@ -2191,7 +2369,9 @@ MY_LOCALE my_locale_es_HN &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_HN *****/ @@ -2205,7 +2385,9 @@ MY_LOCALE my_locale_es_MX &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_MX *****/ @@ -2219,7 +2401,9 @@ MY_LOCALE my_locale_es_NI &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_NI *****/ @@ -2233,7 +2417,9 @@ MY_LOCALE my_locale_es_PA &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_PA *****/ @@ -2247,7 +2433,9 @@ MY_LOCALE my_locale_es_PE &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_PE *****/ @@ -2261,7 +2449,9 @@ MY_LOCALE my_locale_es_PR &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_PR *****/ @@ -2275,7 +2465,9 @@ MY_LOCALE my_locale_es_PY &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_PY *****/ @@ -2289,7 +2481,9 @@ MY_LOCALE my_locale_es_SV &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_SV *****/ @@ -2303,7 +2497,9 @@ MY_LOCALE my_locale_es_US &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_US *****/ @@ -2317,7 +2513,9 @@ MY_LOCALE my_locale_es_UY &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_UY *****/ @@ -2331,7 +2529,9 @@ MY_LOCALE my_locale_es_VE &my_locale_typelib_month_names_es_ES, &my_locale_typelib_ab_month_names_es_ES, &my_locale_typelib_day_names_es_ES, - &my_locale_typelib_ab_day_names_es_ES + &my_locale_typelib_ab_day_names_es_ES, + 10, + 9 ); /***** LOCALE END es_VE *****/ @@ -2345,7 +2545,9 @@ MY_LOCALE my_locale_fr_BE &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_BE *****/ @@ -2359,7 +2561,9 @@ MY_LOCALE my_locale_fr_CA &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_CA *****/ @@ -2373,7 +2577,9 @@ MY_LOCALE my_locale_fr_CH &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_CH *****/ @@ -2387,7 +2593,9 @@ MY_LOCALE my_locale_fr_LU &my_locale_typelib_month_names_fr_FR, &my_locale_typelib_ab_month_names_fr_FR, &my_locale_typelib_day_names_fr_FR, - &my_locale_typelib_ab_day_names_fr_FR + &my_locale_typelib_ab_day_names_fr_FR, + 9, + 8 ); /***** LOCALE END fr_LU *****/ @@ -2401,7 +2609,9 @@ MY_LOCALE my_locale_it_IT &my_locale_typelib_month_names_it_CH, &my_locale_typelib_ab_month_names_it_CH, &my_locale_typelib_day_names_it_CH, - &my_locale_typelib_ab_day_names_it_CH + &my_locale_typelib_ab_day_names_it_CH, + 9, + 9 ); /***** LOCALE END it_IT *****/ @@ -2415,7 +2625,9 @@ MY_LOCALE my_locale_nl_BE &my_locale_typelib_month_names_nl_NL, &my_locale_typelib_ab_month_names_nl_NL, &my_locale_typelib_day_names_nl_NL, - &my_locale_typelib_ab_day_names_nl_NL + &my_locale_typelib_ab_day_names_nl_NL, + 9, + 9 ); /***** LOCALE END nl_BE *****/ @@ -2429,7 +2641,9 @@ MY_LOCALE my_locale_no_NO &my_locale_typelib_month_names_nb_NO, &my_locale_typelib_ab_month_names_nb_NO, &my_locale_typelib_day_names_nb_NO, - &my_locale_typelib_ab_day_names_nb_NO + &my_locale_typelib_ab_day_names_nb_NO, + 9, + 7 ); /***** LOCALE END no_NO *****/ @@ -2443,7 +2657,9 @@ MY_LOCALE my_locale_sv_FI &my_locale_typelib_month_names_sv_SE, &my_locale_typelib_ab_month_names_sv_SE, &my_locale_typelib_day_names_sv_SE, - &my_locale_typelib_ab_day_names_sv_SE + &my_locale_typelib_ab_day_names_sv_SE, + 9, + 7 ); /***** LOCALE END sv_FI *****/ @@ -2457,7 +2673,9 @@ MY_LOCALE my_locale_zh_HK &my_locale_typelib_month_names_zh_CN, &my_locale_typelib_ab_month_names_zh_CN, &my_locale_typelib_day_names_zh_CN, - &my_locale_typelib_ab_day_names_zh_CN + &my_locale_typelib_ab_day_names_zh_CN, + 3, + 3 ); /***** LOCALE END zh_HK *****/ diff --git a/strings/ctype.c b/strings/ctype.c index 372a1a8a468..548005f8463 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -337,6 +337,16 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length) } +/* + Returns repertoire for charset +*/ +uint my_charset_repertoire(CHARSET_INFO *cs) +{ + return cs->state & MY_CS_PUREASCII ? + MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; +} + + /* Detect whether a character set is ASCII compatible. -- cgit v1.2.1 From e138336894c047298b10c476f961e57abb9faf75 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 23 Dec 2008 18:56:08 +0400 Subject: Bug#41079 information_schema.schema_privileges is limited to 7680 records. The problem is that we cannot insert new record into memory table when table size exceeds max memory table size. The fix is to use schema_table_store_record() function which converts memory table into MyISAM in case of table size exceeding. Note: There is no test case for this bug, the reason is that 1. The code that was added already is checked(i.e. works) with existing tests 2. Correct work of schema_table_store_record() is checked with other test cases (information_schema tests) So new code is fully covered with existing test cases. sql/mysql_priv.h: make schema_table_store_record() function global sql/sql_acl.cc: The problem is that we cannot insert new record into memory table when table size exceeds max memory table size. The fix is to use schema_table_store_record() function which converts memory table into MyISAM in case of table size exceeding. sql/sql_show.cc: make schema_table_store_record() function global --- sql/mysql_priv.h | 1 + sql/sql_acl.cc | 119 +++++++++++++++++++++++++++++++++++++++---------------- sql/sql_show.cc | 4 +- 3 files changed, 87 insertions(+), 37 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index a06a7e7d6e3..8a8513ac745 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -983,6 +983,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond); bool get_schema_tables_result(JOIN *join, enum enum_schema_table_state executed_place); enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table); +bool schema_table_store_record(THD *thd, TABLE *table); #define is_schema_db(X) \ !my_strcasecmp(system_charset_info, INFORMATION_SCHEMA_NAME.str, (X)) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index df5e844749f..57029f46162 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5953,10 +5953,11 @@ int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr) } -void update_schema_privilege(TABLE *table, char *buff, const char* db, - const char* t_name, const char* column, - uint col_length, const char *priv, - uint priv_length, const char* is_grantable) +static bool update_schema_privilege(THD *thd, TABLE *table, char *buff, + const char* db, const char* t_name, + const char* column, uint col_length, + const char *priv, uint priv_length, + const char* is_grantable) { int i= 2; CHARSET_INFO *cs= system_charset_info; @@ -5970,13 +5971,14 @@ void update_schema_privilege(TABLE *table, char *buff, const char* db, table->field[i++]->store(column, col_length, cs); table->field[i++]->store(priv, priv_length, cs); table->field[i]->store(is_grantable, strlen(is_grantable), cs); - table->file->write_row(table->record[0]); + return schema_table_store_record(thd, table); } int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) { #ifndef NO_EMBEDDED_ACCESS_CHECKS + int error= 0; uint counter; ACL_USER *acl_user; ulong want_access; @@ -6010,8 +6012,14 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) strxmov(buff,"'",user,"'@'",host,"'",NullS); if (!(want_access & ~GRANT_ACL)) - update_schema_privilege(table, buff, 0, 0, 0, 0, - STRING_WITH_LEN("USAGE"), is_grantable); + { + if (update_schema_privilege(thd, table, buff, 0, 0, 0, 0, + STRING_WITH_LEN("USAGE"), is_grantable)) + { + error= 1; + goto err; + } + } else { uint priv_id; @@ -6019,16 +6027,22 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) for (priv_id=0, j = SELECT_ACL;j <= GLOBAL_ACLS; priv_id++,j <<= 1) { if (test_access & j) - update_schema_privilege(table, buff, 0, 0, 0, 0, - command_array[priv_id], - command_lengths[priv_id], is_grantable); + { + if (update_schema_privilege(thd, table, buff, 0, 0, 0, 0, + command_array[priv_id], + command_lengths[priv_id], is_grantable)) + { + error= 1; + goto err; + } + } } } } - +err: pthread_mutex_unlock(&acl_cache->lock); - DBUG_RETURN(0); + DBUG_RETURN(error); #else return(0); #endif @@ -6038,6 +6052,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) { #ifndef NO_EMBEDDED_ACCESS_CHECKS + int error= 0; uint counter; ACL_DB *acl_db; ulong want_access; @@ -6075,24 +6090,36 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) } strxmov(buff,"'",user,"'@'",host,"'",NullS); if (!(want_access & ~GRANT_ACL)) - update_schema_privilege(table, buff, acl_db->db, 0, 0, - 0, STRING_WITH_LEN("USAGE"), is_grantable); + { + if (update_schema_privilege(thd, table, buff, acl_db->db, 0, 0, + 0, STRING_WITH_LEN("USAGE"), is_grantable)) + { + error= 1; + goto err; + } + } else { int cnt; ulong j,test_access= want_access & ~GRANT_ACL; for (cnt=0, j = SELECT_ACL; j <= DB_ACLS; cnt++,j <<= 1) if (test_access & j) - update_schema_privilege(table, buff, acl_db->db, 0, 0, 0, - command_array[cnt], command_lengths[cnt], - is_grantable); + { + if (update_schema_privilege(thd, table, buff, acl_db->db, 0, 0, 0, + command_array[cnt], command_lengths[cnt], + is_grantable)) + { + error= 1; + goto err; + } + } } } } - +err: pthread_mutex_unlock(&acl_cache->lock); - DBUG_RETURN(0); + DBUG_RETURN(error); #else return (0); #endif @@ -6102,6 +6129,7 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) { #ifndef NO_EMBEDDED_ACCESS_CHECKS + int error= 0; uint index; char buff[100]; TABLE *table= tables->table; @@ -6141,8 +6169,15 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) strxmov(buff, "'", user, "'@'", host, "'", NullS); if (!test_access) - update_schema_privilege(table, buff, grant_table->db, grant_table->tname, - 0, 0, STRING_WITH_LEN("USAGE"), is_grantable); + { + if (update_schema_privilege(thd, table, buff, grant_table->db, + grant_table->tname, 0, 0, + STRING_WITH_LEN("USAGE"), is_grantable)) + { + error= 1; + goto err; + } + } else { ulong j; @@ -6150,17 +6185,24 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) for (cnt= 0, j= SELECT_ACL; j <= TABLE_ACLS; cnt++, j<<= 1) { if (test_access & j) - update_schema_privilege(table, buff, grant_table->db, - grant_table->tname, 0, 0, command_array[cnt], - command_lengths[cnt], is_grantable); + { + if (update_schema_privilege(thd, table, buff, grant_table->db, + grant_table->tname, 0, 0, + command_array[cnt], + command_lengths[cnt], is_grantable)) + { + error= 1; + goto err; + } + } } } - } + } } - +err: rw_unlock(&LOCK_grant); - DBUG_RETURN(0); + DBUG_RETURN(error); #else return (0); #endif @@ -6170,6 +6212,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) { #ifndef NO_EMBEDDED_ACCESS_CHECKS + int error= 0; uint index; char buff[100]; TABLE *table= tables->table; @@ -6219,22 +6262,28 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) GRANT_COLUMN *grant_column = (GRANT_COLUMN*) hash_element(&grant_table->hash_columns,col_index); if ((grant_column->rights & j) && (table_access & j)) - update_schema_privilege(table, buff, grant_table->db, - grant_table->tname, - grant_column->column, - grant_column->key_length, - command_array[cnt], - command_lengths[cnt], is_grantable); + { + if (update_schema_privilege(thd, table, buff, grant_table->db, + grant_table->tname, + grant_column->column, + grant_column->key_length, + command_array[cnt], + command_lengths[cnt], is_grantable)) + { + error= 1; + goto err; + } + } } } } } } } - +err: rw_unlock(&LOCK_grant); - DBUG_RETURN(0); + DBUG_RETURN(error); #else return (0); #endif diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 59082e0a295..c10580e8913 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -44,7 +44,7 @@ static void append_algorithm(TABLE_LIST *table, String *buff); static int view_store_create_info(THD *thd, TABLE_LIST *table, String *buff); -static bool schema_table_store_record(THD *thd, TABLE *table); +bool schema_table_store_record(THD *thd, TABLE *table); /*************************************************************************** @@ -1884,7 +1884,7 @@ typedef struct st_index_field_values 1 error */ -static bool schema_table_store_record(THD *thd, TABLE *table) +bool schema_table_store_record(THD *thd, TABLE *table) { int error; if ((error= table->file->write_row(table->record[0]))) -- cgit v1.2.1 From e6b9fb32a7923169b4dffcf3e9ba4c5700428137 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Tue, 23 Dec 2008 19:33:46 +0400 Subject: Bug#40104 regression with table names? On Winodws FN_DEVCHAR is ':' symbol. There is a check in mysql_create_table_no_lock() func on FN_DEVCHAR presence but this code is obsolete and unnecessary. So the fix is to remove unnecessary code. mysql-test/r/create.result: test result mysql-test/t/create.test: test case sql/sql_table.cc: On Winodws FN_DEVCHAR is ':' symbol. There is a check in mysql_create_table_no_lock() func on FN_DEVCHAR presence but this code is obsolete and unnecessary. So the fix is to remove unnecessary code. --- mysql-test/r/create.result | 2 ++ mysql-test/t/create.test | 6 ++++++ sql/sql_table.cc | 8 -------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 947890d2085..67f81cb4fa5 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1890,5 +1890,7 @@ c1 c2 DROP TABLE t1; # -- End of Bug#34274 +create table `me:i`(id int); +drop table `me:i`; End of 5.1 tests diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 2eeca1eea90..20a607da826 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1532,5 +1532,11 @@ DROP TABLE t1; ########################################################################### +# +# Bug#40104 regression with table names? +# +create table `me:i`(id int); +drop table `me:i`; + --echo --echo End of 5.1 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 51b16ba0f43..f20117ebac7 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3427,14 +3427,6 @@ bool mysql_create_table_no_lock(THD *thd, } else { - #ifdef FN_DEVCHAR - /* check if the table name contains FN_DEVCHAR when defined */ - if (strchr(alias, FN_DEVCHAR)) - { - my_error(ER_WRONG_TABLE_NAME, MYF(0), alias); - DBUG_RETURN(TRUE); - } -#endif path_length= build_table_filename(path, sizeof(path), db, alias, reg_ext, internal_tmp_table ? FN_IS_TMP : 0); } -- cgit v1.2.1 From 4794f463b6e4b14eea3656df14753ab23611afaf Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 24 Dec 2008 18:45:47 +0400 Subject: compiler warning fix --- sql/mysqld.cc | 2 +- sql/sql_acl.cc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f5e5b881a37..269e1aed7cc 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3616,6 +3616,7 @@ void decrement_handler_count() #endif /* defined(__NT__) || defined(HAVE_SMEM) */ +#ifndef EMBEDDED_LIBRARY #ifndef DBUG_OFF /* Debugging helper function to keep the locale database @@ -3654,7 +3655,6 @@ static void test_lc_time_sz() #endif//DBUG_OFF -#ifndef EMBEDDED_LIBRARY #ifdef __WIN__ int win_main(int argc, char **argv) #else diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 57029f46162..22135d376fe 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5953,6 +5953,7 @@ int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr) } +#ifndef NO_EMBEDDED_ACCESS_CHECKS static bool update_schema_privilege(THD *thd, TABLE *table, char *buff, const char* db, const char* t_name, const char* column, uint col_length, @@ -5973,6 +5974,7 @@ static bool update_schema_privilege(THD *thd, TABLE *table, char *buff, table->field[i]->store(is_grantable, strlen(is_grantable), cs); return schema_table_store_record(thd, table); } +#endif int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) -- cgit v1.2.1 From 65c3d37111c510f544196c6d57b46674a80ef6d7 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 24 Dec 2008 19:01:41 +0400 Subject: Bug#25830 SHOW TABLE STATUS behaves differently depending on table name replace wild_case_compare with my_wildcmp which is multibyte safe function mysql-test/r/lowercase_utf8.result: test result mysql-test/t/lowercase_utf8-master.opt: test case mysql-test/t/lowercase_utf8.test: test case sql/sql_show.cc: replace wild_case_compare with my_wildcmp which is multibyte safe function --- mysql-test/r/lowercase_utf8.result | 9 +++++++++ mysql-test/t/lowercase_utf8-master.opt | 4 ++++ mysql-test/t/lowercase_utf8.test | 9 +++++++++ sql/sql_show.cc | 17 +++++++++++++---- 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 mysql-test/r/lowercase_utf8.result create mode 100644 mysql-test/t/lowercase_utf8-master.opt create mode 100644 mysql-test/t/lowercase_utf8.test diff --git a/mysql-test/r/lowercase_utf8.result b/mysql-test/r/lowercase_utf8.result new file mode 100644 index 00000000000..043226e1f64 --- /dev/null +++ b/mysql-test/r/lowercase_utf8.result @@ -0,0 +1,9 @@ +set names utf8; +create table `Ö` (id int); +show tables from test like 'Ö'; +Tables_in_test (Ö) +ö +show tables from test like 'ö'; +Tables_in_test (ö) +ö +drop table `Ö`; diff --git a/mysql-test/t/lowercase_utf8-master.opt b/mysql-test/t/lowercase_utf8-master.opt new file mode 100644 index 00000000000..1b70aa33023 --- /dev/null +++ b/mysql-test/t/lowercase_utf8-master.opt @@ -0,0 +1,4 @@ +--lower-case-table-names=1 --character-set-server=utf8 + + + diff --git a/mysql-test/t/lowercase_utf8.test b/mysql-test/t/lowercase_utf8.test new file mode 100644 index 00000000000..01b154598fd --- /dev/null +++ b/mysql-test/t/lowercase_utf8.test @@ -0,0 +1,9 @@ +# +# Bug#25830 SHOW TABLE STATUS behaves differently depending on table name +# +set names utf8; +create table `Ö` (id int); +show tables from test like 'Ö'; +show tables from test like 'ö'; +drop table `Ö`; + diff --git a/sql/sql_show.cc b/sql/sql_show.cc index c10580e8913..322b1851560 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -287,11 +287,17 @@ find_files(THD *thd, List *files, const char *db, #ifndef NO_EMBEDDED_ACCESS_CHECKS uint col_access=thd->col_access; #endif + uint wild_length= 0; TABLE_LIST table_list; DBUG_ENTER("find_files"); - if (wild && !wild[0]) - wild=0; + if (wild) + { + if (!wild[0]) + wild= 0; + else + wild_length= strlen(wild); + } bzero((char*) &table_list,sizeof(table_list)); @@ -340,8 +346,11 @@ find_files(THD *thd, List *files, const char *db, { if (lower_case_table_names) { - if (wild_case_compare(files_charset_info, file->name, wild)) - continue; + if (my_wildcmp(files_charset_info, + file->name, file->name + strlen(file->name), + wild, wild + wild_length, + wild_prefix, wild_one, wild_many)) + continue; } else if (wild_compare(file->name,wild,0)) continue; -- cgit v1.2.1 From 7103f4c91631dd1e725996429a6f8ccaf4d844d8 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 24 Dec 2008 19:14:59 +0400 Subject: Bug#41456 SET PASSWORD hates CURRENT_USER() init user->user struct with thd->security_ctx->priv_user context if user->user is not initializied mysql-test/r/grant.result: test result mysql-test/t/grant.test: test case sql/set_var.cc: init user->user struct with thd->security_ctx->priv_user context if user->user is not initializied --- mysql-test/r/grant.result | 5 +++++ mysql-test/t/grant.test | 7 +++++++ sql/set_var.cc | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index d56020c3090..ee328d461ac 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1151,4 +1151,9 @@ drop user 'greg'@'localhost'; drop view v1; drop table test; drop function test_function; +SELECT CURRENT_USER(); +CURRENT_USER() +root@localhost +SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); +SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); End of 5.0 tests diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index e4b95502143..14c5879d007 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1175,4 +1175,11 @@ drop view v1; drop table test; drop function test_function; +# +# Bug#41456 SET PASSWORD hates CURRENT_USER() +# +SELECT CURRENT_USER(); +SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); +SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); + --echo End of 5.0 tests diff --git a/sql/set_var.cc b/sql/set_var.cc index 59741e5683d..a29abe6581f 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -3475,6 +3475,7 @@ int set_var_password::check(THD *thd) #ifndef NO_EMBEDDED_ACCESS_CHECKS if (!user->host.str) { + DBUG_ASSERT(thd->security_ctx->priv_host); if (*thd->security_ctx->priv_host != 0) { user->host.str= (char *) thd->security_ctx->priv_host; @@ -3486,6 +3487,12 @@ int set_var_password::check(THD *thd) user->host.length= 1; } } + if (!user->user.str) + { + DBUG_ASSERT(thd->security_ctx->priv_user); + user->user.str= (char *) thd->security_ctx->priv_user; + user->user.length= strlen(thd->security_ctx->priv_user); + } /* Returns 1 as the function sends error to client */ return check_change_password(thd, user->host.str, user->user.str, password, strlen(password)) ? 1 : 0; -- cgit v1.2.1 From ce985aa36e2fb9cb036ae66376bf3c0dfab433be Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 24 Dec 2008 19:24:11 +0400 Subject: Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error Table could be marked dependent because it is either 1) an inner table of an outer join, or 2) it is a part of STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not be assigned. The fix is to set st_table::maybe_null to 'true' only for those tables which are used in outer join. mysql-test/r/select.result: test result mysql-test/t/select.test: test case sql/sql_select.cc: Table could be marked dependent because it is either 1) an inner table of an outer join, or 2) it is a part of STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not be assigned. The fix is to set st_table::maybe_null to 'true' only for those tables which are used in outer join. sql/sql_select.h: added comment --- mysql-test/r/select.result | 33 +++++++++++++++++++++++++++++++++ mysql-test/t/select.test | 36 ++++++++++++++++++++++++++++++++++++ sql/sql_select.cc | 2 +- sql/sql_select.h | 6 +++++- 4 files changed, 75 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index c2cd2129a32..67ce231a157 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4355,4 +4355,37 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 6 DROP TABLE t1, t2; +CREATE TABLE t1 (f1 bigint(20) NOT NULL default '0', +f2 int(11) NOT NULL default '0', +f3 bigint(20) NOT NULL default '0', +f4 varchar(255) NOT NULL default '', +PRIMARY KEY (f1), +KEY key1 (f4), +KEY key2 (f2)); +CREATE TABLE t2 (f1 int(11) NOT NULL default '0', +f2 enum('A1','A2','A3') NOT NULL default 'A1', +f3 int(11) NOT NULL default '0', +PRIMARY KEY (f1), +KEY key1 (f3)); +CREATE TABLE t3 (f1 bigint(20) NOT NULL default '0', +f2 datetime NOT NULL default '1980-01-01 00:00:00', +PRIMARY KEY (f1)); +insert into t1 values (1, 1, 1, 'abc'); +insert into t1 values (2, 1, 2, 'def'); +insert into t1 values (3, 1, 2, 'def'); +insert into t2 values (1, 'A1', 1); +insert into t3 values (1, '1980-01-01'); +SELECT a.f3, cr.f4, count(*) count +FROM t2 a +STRAIGHT_JOIN t1 cr ON cr.f2 = a.f1 +LEFT JOIN +(t1 cr2 +JOIN t3 ae2 ON cr2.f3 = ae2.f1 +) ON a.f1 = cr2.f2 AND ae2.f2 < now() - INTERVAL 7 DAY AND +cr.f4 = cr2.f4 +GROUP BY a.f3, cr.f4; +f3 f4 count +1 abc 1 +1 def 2 +drop table t1, t2, t3; End of 5.0 tests diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 1ee87957643..1e8dc7ac2f6 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3701,4 +3701,40 @@ SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3; SHOW STATUS LIKE 'Handler_read%'; DROP TABLE t1, t2; +# +# Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error +# +CREATE TABLE t1 (f1 bigint(20) NOT NULL default '0', + f2 int(11) NOT NULL default '0', + f3 bigint(20) NOT NULL default '0', + f4 varchar(255) NOT NULL default '', + PRIMARY KEY (f1), + KEY key1 (f4), + KEY key2 (f2)); +CREATE TABLE t2 (f1 int(11) NOT NULL default '0', + f2 enum('A1','A2','A3') NOT NULL default 'A1', + f3 int(11) NOT NULL default '0', + PRIMARY KEY (f1), + KEY key1 (f3)); +CREATE TABLE t3 (f1 bigint(20) NOT NULL default '0', + f2 datetime NOT NULL default '1980-01-01 00:00:00', + PRIMARY KEY (f1)); + +insert into t1 values (1, 1, 1, 'abc'); +insert into t1 values (2, 1, 2, 'def'); +insert into t1 values (3, 1, 2, 'def'); +insert into t2 values (1, 'A1', 1); +insert into t3 values (1, '1980-01-01'); + +SELECT a.f3, cr.f4, count(*) count +FROM t2 a +STRAIGHT_JOIN t1 cr ON cr.f2 = a.f1 +LEFT JOIN +(t1 cr2 + JOIN t3 ae2 ON cr2.f3 = ae2.f1 +) ON a.f1 = cr2.f2 AND ae2.f2 < now() - INTERVAL 7 DAY AND +cr.f4 = cr2.f4 +GROUP BY a.f3, cr.f4; + +drop table t1, t2, t3; --echo End of 5.0 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d2c469f99da..230b9bb36cf 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2489,7 +2489,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds, if (s->dependent & table->map) s->dependent |= table->reginfo.join_tab->dependent; } - if (s->dependent) + if (outer_join & s->table->map) s->table->maybe_null= 1; } /* Catch illegal cross references for outer joins */ diff --git a/sql/sql_select.h b/sql/sql_select.h index c2f0780f5be..8ece01d3286 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -235,7 +235,11 @@ public: fetching data from a cursor */ bool resume_nested_loop; - table_map const_table_map,found_const_table_map,outer_join; + table_map const_table_map,found_const_table_map; + /* + Bitmap of all inner tables from outer joins + */ + table_map outer_join; ha_rows send_records,found_records,examined_rows,row_limit, select_limit; /* Used to fetch no more than given amount of rows per one -- cgit v1.2.1 From 8be4724cd907ae77b418cd2d17209bf0e54c71b8 Mon Sep 17 00:00:00 2001 From: Kent Boortz Date: Sun, 28 Dec 2008 07:57:09 +0100 Subject: Increased thread stack size to 128K, as this is the minimum (Bug#41577) --- support-files/my-small.cnf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-files/my-small.cnf.sh b/support-files/my-small.cnf.sh index cf2ebed463c..24c08408b46 100644 --- a/support-files/my-small.cnf.sh +++ b/support-files/my-small.cnf.sh @@ -34,7 +34,7 @@ sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K -thread_stack = 64K +thread_stack = 128K # Don't listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. -- cgit v1.2.1 From 17a797528d3c7057949d21fb200e7a69ce540d2b Mon Sep 17 00:00:00 2001 From: Kent Boortz Date: Sun, 28 Dec 2008 08:00:23 +0100 Subject: Make sure cluster builds include all charsets --- support-files/mysql.spec.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index a535e778281..7c08fdf4734 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -272,7 +272,11 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --with-unix-socket-path=/var/lib/mysql/mysql.sock \ --with-pic \ --prefix=/ \ +%if %{CLUSTER_BUILD} --with-extra-charsets=all \ +%else + --with-extra-charsets=complex \ +%endif %if %{YASSL_BUILD} --with-ssl \ %endif -- cgit v1.2.1 From f257aac8148626c81fb3447eeb2bb85d9756735e Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Sun, 28 Dec 2008 12:33:49 +0100 Subject: Bug#40972: some sql execution lead the whole databse crashing Problem was an errornous date that lead to end partition was before the start, leading to a crash. Solution was to check greater or equal instead of only equal between start and end partition. NOTE: partitioning pruning handles incorrect dates differently than index lookup, which can give different results in a partitioned table versus a non partitioned table for queries having 'bad' dates in the where clause. mysql-test/r/partition_pruning.result: Bug#40972: some sql execution lead the whole databse crashing Updated result file mysql-test/t/partition_pruning.test: Bug#40972: some sql execution lead the whole databse crashing Added test. sql/sql_partition.cc: Bug#40972: some sql execution lead the whole databse crashing There can be cases where the start/cur partition is greater than the end partition, so it must not continue, since that can lead to a crash. --- mysql-test/r/partition_pruning.result | 12 ++++++++++++ mysql-test/t/partition_pruning.test | 16 ++++++++++++++++ sql/sql_partition.cc | 4 ++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index b153ad9ad47..26ddc92e97b 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -1,4 +1,16 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +CREATE TABLE t1 +(a INT NOT NULL AUTO_INCREMENT, +b DATETIME, +PRIMARY KEY (a,b), +KEY (b)) +PARTITION BY RANGE (to_days(b)) +(PARTITION p0 VALUES LESS THAN (733681) COMMENT = 'LESS THAN 2008-10-01', +PARTITION p1 VALUES LESS THAN (733712) COMMENT = 'LESS THAN 2008-11-01', +PARTITION pX VALUES LESS THAN MAXVALUE); +SELECT a,b FROM t1 WHERE b >= '2008-12-01' AND b < '2009-12-00'; +a b +DROP TABLE t1; create table t1 ( a int not null) partition by hash(a) partitions 2; insert into t1 values (1),(2),(3); explain select * from t1 where a=5 and a=6; diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 31008d2b011..ad102062ef8 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -8,6 +8,22 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings +# +# Bug#40972: some sql execution lead the whole database crashing +# +# Setup so the start is at partition pX and end is at p1 +# Pruning does handle 'bad' dates differently. +CREATE TABLE t1 +(a INT NOT NULL AUTO_INCREMENT, + b DATETIME, + PRIMARY KEY (a,b), + KEY (b)) +PARTITION BY RANGE (to_days(b)) +(PARTITION p0 VALUES LESS THAN (733681) COMMENT = 'LESS THAN 2008-10-01', + PARTITION p1 VALUES LESS THAN (733712) COMMENT = 'LESS THAN 2008-11-01', + PARTITION pX VALUES LESS THAN MAXVALUE); +SELECT a,b FROM t1 WHERE b >= '2008-12-01' AND b < '2009-12-00'; +DROP TABLE t1; # Check if we can infer from condition on partition fields that # no records will match. diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index c1df5552eb9..9096a2b91ef 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -6760,7 +6760,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, store_key_image_to_rec(field, max_value, field_len); bool include_endp= !test(flags & NEAR_MAX); part_iter->part_nums.end= get_endpoint(part_info, 0, include_endp); - if (part_iter->part_nums.start == part_iter->part_nums.end && + if (part_iter->part_nums.start >= part_iter->part_nums.end && !part_iter->ret_null_part) return 0; /* No partitions */ } @@ -6938,7 +6938,7 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info, uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter) { - if (part_iter->part_nums.cur == part_iter->part_nums.end) + if (part_iter->part_nums.cur >= part_iter->part_nums.end) { part_iter->part_nums.cur= part_iter->part_nums.start; return NOT_A_PARTITION_ID; -- cgit v1.2.1 From 3b617acb87bce94b6ac27e3d91017cfaa9d67b83 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Mon, 29 Dec 2008 16:06:53 +0400 Subject: Bug#41131 "Questions" fails to increment - ignores statements instead stored procs(5.0 ver) Added global status variable 'Queries' which represents total amount of queries executed by server including statements executed by SPs. note: It's old behaviour of 'Questions' variable. mysql-test/r/status.result: test result mysql-test/t/status.test: test case sql/mysqld.cc: Added global status variable 'Queries' which represents total amount of queries executed by server including statements executed by SPs. note: It's old behaviour of 'Questions' variable. sql/sql_show.cc: Added global status variable 'Queries' which represents total amount of queries executed by server including statements executed by SPs. note: It's old behaviour of 'Questions' variable. sql/structs.h: Added global status variable 'Queries' which represents total amount of queries executed by server including statements executed by SPs. note: It's old behaviour of 'Questions' variable. --- mysql-test/r/status.result | 25 +++++++++++++++++++++++++ mysql-test/t/status.test | 36 ++++++++++++++++++++++++++++++++++++ sql/mysqld.cc | 1 + sql/sql_show.cc | 3 +++ sql/structs.h | 2 +- 5 files changed, 66 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index 36857e22aaf..971e399a3b6 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -91,3 +91,28 @@ SHOW SESSION STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 4.805836 DROP TABLE t1; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +CREATE FUNCTION f1() RETURNS INTEGER +BEGIN +DECLARE foo INTEGER; +DECLARE bar INTEGER; +SET foo=1; +SET bar=2; +RETURN foo; +END $$ +CREATE PROCEDURE p1() +BEGIN +SELECT 1; +END $$ +SELECT f1(); +f1() +1 +CALL p1(); +1 +1 +SELECT 9; +9 +9 +DROP PROCEDURE p1; +DROP FUNCTION f1; diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index 33bba3a626a..ee92d649f47 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -171,4 +171,40 @@ SHOW SESSION STATUS LIKE 'Last_query_cost'; DROP TABLE t1; +# +# Bug#41131 "Questions" fails to increment - ignores statements instead stored procs +# +connect (con1,localhost,root,,); +connection con1; +--disable_warnings +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings +DELIMITER $$; +CREATE FUNCTION f1() RETURNS INTEGER +BEGIN + DECLARE foo INTEGER; + DECLARE bar INTEGER; + SET foo=1; + SET bar=2; + RETURN foo; +END $$ +CREATE PROCEDURE p1() + BEGIN + SELECT 1; +END $$ +DELIMITER ;$$ +let $org_queries= `SHOW STATUS LIKE 'Queries'`; +SELECT f1(); +CALL p1(); +let $new_queries= `SHOW STATUS LIKE 'Queries'`; +--disable_log +let $diff= `SELECT SUBSTRING('$new_queries',9)-SUBSTRING('$org_queries',9)`; +--enable_log +eval SELECT $diff; +disconnect con1; +connection default; +DROP PROCEDURE p1; +DROP FUNCTION f1; + # End of 5.0 tests diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 269e1aed7cc..ca68976d939 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6620,6 +6620,7 @@ struct show_var_st status_vars[]= { {"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_CONST}, {"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_CONST}, #endif /*HAVE_QUERY_CACHE*/ + {"Queries", (char*) 0, SHOW_QUERIES}, {"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS}, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 322b1851560..2d8d6b13d4e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1543,6 +1543,9 @@ static bool show_status_array(THD *thd, const char *wild, nr= (long) (thd->query_start() - server_start_time); end= int10_to_str(nr, buff, 10); break; + case SHOW_QUERIES: + end= int10_to_str((long) thd->query_id, buff, 10); + break; #ifdef HAVE_REPLICATION case SHOW_RPL_STATUS: end= strmov(buff, rpl_status_type[(int)rpl_status]); diff --git a/sql/structs.h b/sql/structs.h index ab8537612fa..9882119b7c5 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -170,7 +170,7 @@ enum SHOW_TYPE SHOW_UNDEF, SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_DOUBLE_STATUS, - SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, + SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUERIES, SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS, SHOW_VARS, #ifdef HAVE_OPENSSL -- cgit v1.2.1 From 47c0ec508467b4941e6e388e33dc688b7247befb Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Mon, 29 Dec 2008 16:50:51 +0400 Subject: Bug#41441 repair csv table crashes debug server The problem: data file can not be deleted on win because there is another opened instance of this file. Data file might be opened twice, on table opening stage and during write_row execution. We need to close both instances to satisfy Win. mysql-test/r/csv.result: test result mysql-test/t/csv.test: test case storage/csv/ha_tina.cc: The problem: data file can not be deleted on win because there is another opened instance of this file. Data file might be opened twice, on table opening stage and during write_row execution. We need to close both instances to satisfy Win. --- mysql-test/r/csv.result | 13 +++++++++++++ mysql-test/t/csv.test | 13 +++++++++++++ storage/csv/ha_tina.cc | 11 +++++++++++ 3 files changed, 37 insertions(+) diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 8bc6114dbc2..9deaf55c535 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5394,4 +5394,17 @@ select * from t1; ERROR HY000: File './test/t1.CSV' not found (Errcode: 2) unlock tables; drop table t1; +create table t1(a enum ('a') not null) engine=csv; +insert into t1 values (2); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1 limit 1; +ERROR HY000: Table 't1' is marked as crashed and should be repaired +repair table t1; +Table Op Msg_type Msg_text +test.t1 repair Warning Data truncated for column 'a' at row 1 +test.t1 repair status OK +select * from t1 limit 1; +a +drop table t1; End of 5.1 tests diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index ac628f96a0f..67295e8756f 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1804,4 +1804,17 @@ unlock tables; drop table t1; --disconnect con1 +# +# Bug#41441 repair csv table crashes debug server +# +# Note: The test should be removed after Bug#33717 is fixed + +create table t1(a enum ('a') not null) engine=csv; +insert into t1 values (2); +--error ER_CRASHED_ON_USAGE +select * from t1 limit 1; +repair table t1; +select * from t1 limit 1; +drop table t1; + --echo End of 5.1 tests diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index a1ff0e29ad1..368ce7e28f3 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -1439,6 +1439,17 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) a file, which descriptor is still open. EACCES will be returned when trying to delete the "to"-file in my_rename(). */ + if (share->tina_write_opened) + { + /* + Data file might be opened twice, on table opening stage and + during write_row execution. We need to close both instances + to satisfy Win. + */ + if (my_close(share->tina_write_filedes, MYF(0))) + DBUG_RETURN(my_errno ? my_errno : -1); + share->tina_write_opened= FALSE; + } if (my_close(data_file,MYF(0)) || my_close(repair_file, MYF(0)) || my_rename(repaired_fname, share->data_file_name, MYF(0))) DBUG_RETURN(-1); -- cgit v1.2.1 From ba835f89ba4a07344322765c27c424a2ea96f6ee Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Mon, 29 Dec 2008 17:04:10 +0100 Subject: BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event Problem: When an Incident_log_event contains a bad incident number on disk, the server crashes with an assertion. Fix: Don't validate input with assertions. Use errors. mysql-test/include/cleanup_fake_relay_log.inc: Added auxiliary file to restore things that setup_fake_relay_log.inc did. mysql-test/include/setup_fake_relay_log.inc: Added auxiliary file to setup replication from an existing relay log. mysql-test/std_data/bug40482-bin.000001: Binlog file for rpl.rpl_binlog_corruption mysql-test/suite/rpl/t/rpl_binlog_corruption.test: New test file. sql/log_event.cc: Check that the incident number is correct at the time the event is constructed. Do not assert it at the time it is printed. sql/log_event.h: Incident_log_event::is_valid() should verify that the incident number is valid. sql/rpl_constants.h: Incident numbers should be hard-coded, since they may appear in files. --- mysql-test/include/cleanup_fake_relay_log.inc | 16 +++++ mysql-test/include/setup_fake_relay_log.inc | 78 +++++++++++++++++++++ mysql-test/std_data/bug40482-bin.000001 | Bin 0 -> 172 bytes .../suite/rpl/r/rpl_binlog_corruption.result | 8 +++ .../suite/rpl/t/rpl_binlog_corruption-master.opt | 1 + mysql-test/suite/rpl/t/rpl_binlog_corruption.test | 42 +++++++++++ sql/log_event.cc | 15 ++-- sql/log_event.h | 5 +- sql/rpl_constants.h | 4 +- 9 files changed, 162 insertions(+), 7 deletions(-) create mode 100644 mysql-test/include/cleanup_fake_relay_log.inc create mode 100644 mysql-test/include/setup_fake_relay_log.inc create mode 100644 mysql-test/std_data/bug40482-bin.000001 create mode 100644 mysql-test/suite/rpl/r/rpl_binlog_corruption.result create mode 100644 mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt create mode 100644 mysql-test/suite/rpl/t/rpl_binlog_corruption.test diff --git a/mysql-test/include/cleanup_fake_relay_log.inc b/mysql-test/include/cleanup_fake_relay_log.inc new file mode 100644 index 00000000000..43aa46cb657 --- /dev/null +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -0,0 +1,16 @@ +# ==== Purpose ==== +# +# Clean up files create by setup_fake_relay_log.inc. +# +# ==== Usage ==== +# +# See setup_fake_relay_log.inc + +--echo Cleaning up after setup_fake_relay_log.inc + +# Remove files. +remove_file $_fake_relay_log; +remove_file $_fake_relay_index; +--disable_query_log +eval SET @@global.relay_log_purge= $_fake_relay_log_purge; +--enable_query_log diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc new file mode 100644 index 00000000000..8113ed6dc10 --- /dev/null +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -0,0 +1,78 @@ +# ==== Purpose ==== +# +# Setup replication from an existing relay log in the current +# connection. +# +# ==== Usage ==== +# +# Make sure the slave is not running and issue: +# +# let $fake_relay_log= /path/to/fake-relay-log-file.000001 +# source include/setup_fake_relay_log.inc; +# START SLAVE SQL_THREAD; # setup_fake_relay_log doesn't start slave +# ... +# source include/cleanup_fake_relay_log.inc +# +# You must run the server with --relay-log=FILE. You probably want to +# run with --replicate-same-server-id too. +# +# ==== Implementation ==== +# +# First makes a sanity check, ensuring that the slave threads are not +# running. Then copies the $fake_relay_log to RELAY_BIN-fake.000001, +# where RELAY_BIN is the basename of the relay log, and updates +# RELAY_BIN.index. Finally issues CHANGE MASTER so that it uses the +# given files. +# +# ==== Side effects ==== +# +# Creates a binlog file and a binlog index file, and sets +# @@global.relay_log_purge=1. All this is restored when you call +# cleanup_fake_relay_log.inc. +# +# Enables the query log. + + +--disable_query_log + +# Print message. +let $_fake_relay_log_printable= `SELECT REPLACE('$fake_relay_log', '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`; +--echo Setting up fake replication from $_fake_relay_log_printable + +# Sanity check. +let $_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1); +let $_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1); +if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) { + --echo Error: Slave was running when test case sourced + --echo include/setup_fake_replication.inc + --echo Slave_IO_Running = $_io_running; Slave_SQL_Running = $_sql_running + --echo Printing some debug info: + SHOW SLAVE STATUS; + SHOW MASTER STATUS; + SHOW BINLOG EVENTS; + SHOW PROCESSLIST; +} + +# Read server variables. +let $MYSQLD_DATADIR= `SELECT @@datadir`; +let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1); +if (`SELECT '$_fake_filename' = ''`) { + --echo Badly written test case: relay_log variable is empty. Please use the + --echo server option --relay-log=FILE. +} +let $_fake_relay_log= $MYSQLD_DATADIR/$_fake_filename-fake.000001; +let $_fake_relay_index= $MYSQLD_DATADIR/$_fake_filename.index; +# Need to restore relay_log_purge in cleanup_fake_relay_log.inc, since +# CHANGE MASTER modifies it (see the manual for CHANGE MASTER). +let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; + +# Create relay log file. +copy_file $fake_relay_log $_fake_relay_log; + +# Create relay log index. +eval SELECT '$_fake_relay_log' INTO OUTFILE '$_fake_relay_index'; + +# Setup replication from existing relay log. +eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_relay_log', RELAY_LOG_POS=4; + +--enable_query_log diff --git a/mysql-test/std_data/bug40482-bin.000001 b/mysql-test/std_data/bug40482-bin.000001 new file mode 100644 index 00000000000..d001bf664c7 Binary files /dev/null and b/mysql-test/std_data/bug40482-bin.000001 differ diff --git a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result new file mode 100644 index 00000000000..f94d2833603 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result @@ -0,0 +1,8 @@ +call mtr.add_suppression('Found invalid event in binary log'); +==== Initialize ==== +Setting up fake replication from MYSQL_TEST_DIR/std_data/bug40482-bin.000001 +==== Test ==== +START SLAVE SQL_THREAD; +Last_SQL_Error = Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. +==== Clean up ==== +Cleaning up after setup_fake_relay_log.inc diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt new file mode 100644 index 00000000000..815a8f81d32 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt @@ -0,0 +1 @@ +--replicate-same-server-id --relay-log=slave-relay-bin diff --git a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test new file mode 100644 index 00000000000..39799180f8b --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test @@ -0,0 +1,42 @@ +# ==== Purpose ==== +# +# Verify that the slave stops gracefully when reading a relay log with +# corrupted data. +# +# ==== Implementation ==== +# +# Setup "fake replication" where the slave only starts the SQL thread, +# not the IO thread, and reads from an existing relay log that has +# been prepared so that it contains the error. This requires some +# extra server options: see the -master.opt file. +# +# ==== Related bugs ==== +# +# BUG#31793: log event corruption causes crash +# BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event + +source include/have_log_bin.inc; +# BUG#40482 only manifested itself in debug-compiled binaries. +source include/have_debug.inc; + +call mtr.add_suppression('Found invalid event in binary log'); + + +# +# BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event +# +# The relay log contains an Incident_log_event with a non-existing +# incident number. + +--echo ==== Initialize ==== +let $fake_relay_log= $MYSQL_TEST_DIR/std_data/bug40482-bin.000001; +source include/setup_fake_relay_log.inc; + +--echo ==== Test ==== +START SLAVE SQL_THREAD; +source include/wait_for_slave_sql_error.inc; +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $error + +--echo ==== Clean up ==== +source include/cleanup_fake_relay_log.inc; diff --git a/sql/log_event.cc b/sql/log_event.cc index cd8fa0c3a85..74ad018df55 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -9057,7 +9057,17 @@ Incident_log_event::Incident_log_event(const char *buf, uint event_len, DBUG_PRINT("info",("event_len: %u; common_header_len: %d; post_header_len: %d", event_len, common_header_len, post_header_len)); - m_incident= static_cast(uint2korr(buf + common_header_len)); + int incident_number= uint2korr(buf + common_header_len); + if (incident_number >= INCIDENT_COUNT || + incident_number <= INCIDENT_NONE) + { + // If the incident is not recognized, this binlog event is + // invalid. If we set incident_number to INCIDENT_NONE, the + // invalidity will be detected by is_valid(). + incident_number= INCIDENT_NONE; + DBUG_VOID_RETURN; + } + m_incident= static_cast(incident_number); char const *ptr= buf + common_header_len + post_header_len; char const *const str_end= buf + event_len; uint8 len= 0; // Assignment to keep compiler happy @@ -9085,9 +9095,6 @@ Incident_log_event::description() const DBUG_PRINT("info", ("m_incident: %d", m_incident)); - DBUG_ASSERT(0 <= m_incident); - DBUG_ASSERT((size_t) m_incident <= sizeof(description)/sizeof(*description)); - return description[m_incident]; } diff --git a/sql/log_event.h b/sql/log_event.h index 3c109b798d3..db14341b51d 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3870,7 +3870,10 @@ public: virtual Log_event_type get_type_code() { return INCIDENT_EVENT; } - virtual bool is_valid() const { return 1; } + virtual bool is_valid() const + { + return m_incident > INCIDENT_NONE && m_incident < INCIDENT_COUNT; + } virtual int get_data_size() { return INCIDENT_HEADER_LEN + 1 + m_message.length; } diff --git a/sql/rpl_constants.h b/sql/rpl_constants.h index 426e80a328d..32fb4b8a7f2 100644 --- a/sql/rpl_constants.h +++ b/sql/rpl_constants.h @@ -6,10 +6,10 @@ */ enum Incident { /** No incident */ - INCIDENT_NONE, + INCIDENT_NONE = 0, /** There are possibly lost events in the replication stream */ - INCIDENT_LOST_EVENTS, + INCIDENT_LOST_EVENTS = 1, /** Shall be last event of the enumeration */ INCIDENT_COUNT -- cgit v1.2.1 From 28e672dbe78084187d34fe519da8bb389e1ba7a1 Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Tue, 30 Dec 2008 09:48:19 +0100 Subject: BUG#41793: rpl_binlog_corruption disabled in main (needs new mtr) Disabled rpl_binlog_corruption since it requires the new mtr, which only exists in 5.1-rpl / 6.0-rpl. Please re-enable the test in 5.1-rpl / 6.0-rpl. mysql-test/suite/rpl/t/disabled.def: Disabled rpl_binlog_corruption since it requires the new mtr, which only exists in 5.1-rpl / 6.0-rpl. --- mysql-test/suite/rpl/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index 8cae44a3607..f3f329c4b5b 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -10,3 +10,4 @@ # ############################################################################## +rpl_binlog_corruption : BUG#41793 2008-12-30 sven rpl_binlog_corruption disabled in main (needs new mtr) -- cgit v1.2.1 From 335e842d24083e8961b7f6b7e9563628dcb8956d Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Wed, 31 Dec 2008 15:55:04 +0400 Subject: Bug #41363: crash of mysqld on windows with aggregate in case Execution of queries containing the CASE function of aggregate function like in "SELECT ... CASE ARGV(...) WHEN ..." crashed the server. The CASE function caches pointers to concrete comparison functions for an each pair of types of CASE-WHERE clause parameters, i.e. for the "CASE INT_RESULT WHERE REAL_RESULT THEN ... WHERE DECIMAL_RESULT ... END" function call it caches comparisons for INT_RESULT with REAL_RESULT and for INT_RESULT with DECIMAL_RESULT. Usually a result type is known after a call to the fix_fields function, however, the setup_copy_fields function call may wrap aggregate items with Item_copy_string that has STRING_RESULT result type, so setup_copy_fields may change argument result types of the CASE function after call to Item_func_case::fix_fields/fix_length_and_dec. Then the Item_func_case::find_item function tries to use comparison function for unexpected pair of the STRING_RESULT and some other type - that caused an assertion failure of server crash. The Item_func_case::fix_length_and_dec function has been modified to take into account possible STRING_RESULT result type in the presence of aggregate arguments of the CASE function. mysql-test/r/func_in.result: Added test case for bug #41363. mysql-test/t/func_in.test: Added test case for bug #41363. sql/item_cmpfunc.cc: Bug #41363: crash of mysqld on windows with aggregate in case The Item_func_case::fix_length_and_dec function has been modified to take into account possible STRING_RESULT result type in the presence of aggregate arguments of the CASE function. --- mysql-test/r/func_in.result | 12 ++++++++++++ mysql-test/t/func_in.test | 13 +++++++++++++ sql/item_cmpfunc.cc | 10 ++++++++++ 3 files changed, 35 insertions(+) diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index e761fb851fb..1e967b668c5 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -575,4 +575,16 @@ id select * from t1 where NOT id in (null, 1); id drop table t1; +CREATE TABLE t1(c0 INTEGER, c1 INTEGER, c2 INTEGER); +INSERT INTO t1 VALUES(1, 1, 1), (1, 1, 1); +SELECT CASE AVG (c0) WHEN c1 * c2 THEN 1 END FROM t1; +CASE AVG (c0) WHEN c1 * c2 THEN 1 END +1 +SELECT CASE c1 * c2 WHEN SUM(c0) THEN 1 WHEN AVG(c0) THEN 2 END FROM t1; +CASE c1 * c2 WHEN SUM(c0) THEN 1 WHEN AVG(c0) THEN 2 END +2 +SELECT CASE c1 WHEN c1 + 1 THEN 1 END, ABS(AVG(c0)) FROM t1; +CASE c1 WHEN c1 + 1 THEN 1 END ABS(AVG(c0)) +NULL 1.0000 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index d0d4dea0713..3fc1697f146 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -426,4 +426,17 @@ select * from t1 where NOT id in (select null union all select 1); select * from t1 where NOT id in (null, 1); drop table t1; +# +# Bug #41363: crash of mysqld on windows with aggregate in case +# + +CREATE TABLE t1(c0 INTEGER, c1 INTEGER, c2 INTEGER); +INSERT INTO t1 VALUES(1, 1, 1), (1, 1, 1); + +SELECT CASE AVG (c0) WHEN c1 * c2 THEN 1 END FROM t1; +SELECT CASE c1 * c2 WHEN SUM(c0) THEN 1 WHEN AVG(c0) THEN 2 END FROM t1; +SELECT CASE c1 WHEN c1 + 1 THEN 1 END, ABS(AVG(c0)) FROM t1; + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c6b70440b41..813e50e0693 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2713,6 +2713,16 @@ void Item_func_case::fix_length_and_dec() nagg++; if (!(found_types= collect_cmp_types(agg, nagg))) return; + if (with_sum_func || current_thd->lex->current_select->group_list.elements) + { + /* + See TODO commentary in the setup_copy_fields function: + item in a group may be wrapped with an Item_copy_string item. + That item has a STRING_RESULT result type, so we need + to take this type into account. + */ + found_types |= (1 << item_cmp_type(left_result_type, STRING_RESULT)); + } for (i= 0; i <= (uint)DECIMAL_RESULT; i++) { -- cgit v1.2.1 From 4978004e8d8eff8d4d9e93e11458b9e131c26456 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 5 Jan 2009 12:37:56 +0200 Subject: Reverted the fix for bug #25830 because of omissions and non-complete test case. --- mysql-test/r/lowercase_utf8.result | 9 --------- mysql-test/t/lowercase_utf8-master.opt | 4 ---- mysql-test/t/lowercase_utf8.test | 9 --------- sql/sql_show.cc | 17 ++++------------- 4 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 mysql-test/r/lowercase_utf8.result delete mode 100644 mysql-test/t/lowercase_utf8-master.opt delete mode 100644 mysql-test/t/lowercase_utf8.test diff --git a/mysql-test/r/lowercase_utf8.result b/mysql-test/r/lowercase_utf8.result deleted file mode 100644 index 043226e1f64..00000000000 --- a/mysql-test/r/lowercase_utf8.result +++ /dev/null @@ -1,9 +0,0 @@ -set names utf8; -create table `Ö` (id int); -show tables from test like 'Ö'; -Tables_in_test (Ö) -ö -show tables from test like 'ö'; -Tables_in_test (ö) -ö -drop table `Ö`; diff --git a/mysql-test/t/lowercase_utf8-master.opt b/mysql-test/t/lowercase_utf8-master.opt deleted file mode 100644 index 1b70aa33023..00000000000 --- a/mysql-test/t/lowercase_utf8-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---lower-case-table-names=1 --character-set-server=utf8 - - - diff --git a/mysql-test/t/lowercase_utf8.test b/mysql-test/t/lowercase_utf8.test deleted file mode 100644 index 01b154598fd..00000000000 --- a/mysql-test/t/lowercase_utf8.test +++ /dev/null @@ -1,9 +0,0 @@ -# -# Bug#25830 SHOW TABLE STATUS behaves differently depending on table name -# -set names utf8; -create table `Ö` (id int); -show tables from test like 'Ö'; -show tables from test like 'ö'; -drop table `Ö`; - diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 2d8d6b13d4e..d6bb3427fe4 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -287,17 +287,11 @@ find_files(THD *thd, List *files, const char *db, #ifndef NO_EMBEDDED_ACCESS_CHECKS uint col_access=thd->col_access; #endif - uint wild_length= 0; TABLE_LIST table_list; DBUG_ENTER("find_files"); - if (wild) - { - if (!wild[0]) - wild= 0; - else - wild_length= strlen(wild); - } + if (wild && !wild[0]) + wild=0; bzero((char*) &table_list,sizeof(table_list)); @@ -346,11 +340,8 @@ find_files(THD *thd, List *files, const char *db, { if (lower_case_table_names) { - if (my_wildcmp(files_charset_info, - file->name, file->name + strlen(file->name), - wild, wild + wild_length, - wild_prefix, wild_one, wild_many)) - continue; + if (wild_case_compare(files_charset_info, file->name, wild)) + continue; } else if (wild_compare(file->name,wild,0)) continue; -- cgit v1.2.1 From fec0b2c27a1035927651eb0927447d1d46e08155 Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Mon, 5 Jan 2009 12:10:22 -0500 Subject: Bug#38833: mysql-test-run needs diff. Problem w/ error handling in calling diff on Windows. Added function to check for diff and return an error message if the utility is not present. Previously, the way we did this didn't work on Windows, but did work on *Nix systems. --- client/mysqltest.c | 81 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 63 insertions(+), 18 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 9c7c4d62f6f..d73cf78d9d4 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1329,6 +1329,35 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...) DBUG_RETURN(ret); } +/* + Test if diff is present. This is needed on Windows systems + as the OS returns 1 whether diff is successful or if it is + not present. + + We run diff -v and look for output in stdout. + We don't redirect stderr to stdout to make for a simplified check + Windows will output '"diff"' is not recognized... to stderr if it is + not present. +*/ + +int diff_check() +{ + char buf[512]= {0}; + FILE *res_file; + char *cmd = "diff -v"; + int have_diff = 0; + + if (!(res_file= popen(cmd, "r"))) + die("popen(\"%s\", \"r\") failed", cmd); + +/* if diff is not present, nothing will be in stdout to increment have_diff */ + if (fgets(buf, sizeof(buf), res_file)) + { + have_diff += 1; + } + pclose(res_file); + return have_diff; +} /* Show the diff of two files using the systems builtin diff @@ -1348,34 +1377,51 @@ void show_diff(DYNAMIC_STRING* ds, { DYNAMIC_STRING ds_tmp; + int have_diff = 0; if (init_dynamic_string(&ds_tmp, "", 256, 256)) die("Out of memory"); + + /* determine if we have diff on Windows + needs special processing due to return values + on that OS + */ + have_diff = diff_check(); - /* First try with unified diff */ - if (run_tool("diff", - &ds_tmp, /* Get output from diff in ds_tmp */ - "-u", - filename1, - filename2, - "2>&1", - NULL) > 1) /* Most "diff" tools return >1 if error */ + if (have_diff) { - dynstr_set(&ds_tmp, ""); - - /* Fallback to context diff with "diff -c" */ + /* First try with unified diff */ if (run_tool("diff", &ds_tmp, /* Get output from diff in ds_tmp */ - "-c", + "-u", filename1, filename2, "2>&1", NULL) > 1) /* Most "diff" tools return >1 if error */ { - /* - Fallback to dump both files to result file and inform - about installing "diff" - */ + dynstr_set(&ds_tmp, ""); + + /* Fallback to context diff with "diff -c" */ + if (run_tool("diff", + &ds_tmp, /* Get output from diff in ds_tmp */ + "-c", + filename1, + filename2, + "2>&1", + NULL) > 1) /* Most "diff" tools return >1 if error */ + { + have_diff= 1; + } + } + } + +if (!(have_diff)) + { + /* + Fallback to dump both files to result file and inform + about installing "diff" + */ + dynstr_set(&ds_tmp, ""); dynstr_append(&ds_tmp, @@ -1399,8 +1445,7 @@ void show_diff(DYNAMIC_STRING* ds, dynstr_append(&ds_tmp, " >>>\n"); cat_file(&ds_tmp, filename2); dynstr_append(&ds_tmp, "<<<<\n"); - } - } + } if (ds) { -- cgit v1.2.1 From f70f527cbb11a9b8506b7f11b60e30b79b020d05 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 6 Jan 2009 15:08:15 +0000 Subject: bug#41828: mysql_install_db misses mysqld options when using --basedir * pass --languages to mysqld when using --basedir * improve error messages when unable to find files in basedir --- scripts/mysql_install_db.sh | 51 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 5a2409eeb6f..20b7973cb4e 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -21,6 +21,7 @@ basedir="" builddir="" ldata="@localstatedir@" +langdir="" srcdir="" args="" @@ -106,7 +107,7 @@ parse_arguments() # Note that the user will be passed to mysqld so that it runs # as 'user' (crucial e.g. if log-bin=/some_other_path/ # where a chown of datadir won't help) - user=`parse_arg "$arg"` ;; + user=`parse_arg "$arg"` ;; --skip-name-resolve) ip_only=1 ;; --verbose) verbose=1 ;; # Obsolete --rpm) in_rpm=1 ;; @@ -171,7 +172,20 @@ find_in_basedir() cannot_find_file() { echo - echo "FATAL ERROR: Could not find $*" + echo "FATAL ERROR: Could not find $1" + + shift + if test $# -ne 0 + then + echo + echo "The following directories were searched:" + echo + for dir in "$@" + do + echo " $dir" + done + fi + echo echo "If you compiled from source, you need to run 'make install' to" echo "copy the software into the correct location ready for operation." @@ -210,6 +224,11 @@ then elif test -n "$basedir" then print_defaults=`find_in_basedir my_print_defaults bin extra` + if test -z "$print_defaults" + then + cannot_find_file my_print_defaults $basedir/bin $basedir/extra + exit 1 + fi else print_defaults="@bindir@/my_print_defaults" fi @@ -232,7 +251,7 @@ then bindir="$basedir/client" extra_bindir="$basedir/extra" mysqld="$basedir/sql/mysqld" - mysqld_opt="--language=$srcdir/sql/share/english" + langdir="$srcdir/sql/share/english" pkgdatadir="$srcdir/scripts" scriptdir="$srcdir/scripts" elif test -n "$basedir" @@ -240,7 +259,23 @@ then bindir="$basedir/bin" extra_bindir="$bindir" mysqld=`find_in_basedir mysqld libexec sbin bin` + if test -z "$mysqld" + then + cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin + exit 1 + fi + langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english` + if test -z "$langdir" + then + cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english + exit 1 + fi pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql` + if test -z "$pkgdatadir" + then + cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql + exit 1 + fi scriptdir="$basedir/scripts" else basedir="@prefix@" @@ -271,6 +306,16 @@ then exit 1 fi +if test -n "$langdir" +then + if test ! -f "$langdir/errmsg.sys" + then + cannot_find_file "$langdir/errmsg.sys" + exit 1 + fi + mysqld_opt="--language=$langdir" +fi + # Try to determine the hostname hostname=`@HOSTNAME@` -- cgit v1.2.1 From 7ba37134d247f6057302f6af9893df603d14afae Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Wed, 7 Jan 2009 10:11:37 -0200 Subject: Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table The problem is that INSERT INTO .. SELECT FROM .. and CREATE TABLE .. SELECT FROM a temporary table could inadvertently overwrite the locking type of the temporary table. The lock type of temporary tables should be a write lock by default. The solution is to reset the lock type of temporary tables back to its default value after they are used in a statement. mysql-test/r/innodb_mysql.result: Add test case result for Bug#41348 mysql-test/r/temp_table.result: Add test case result for Bug#41348 mysql-test/t/innodb_mysql.test: Add test case for Bug#41348 mysql-test/t/temp_table.test: Add test case for Bug#41348 sql/sql_base.cc: Allow the lock type of temp tables to be overwritten now that the the value is being restored once the table is marked as free for re-use. This makes the behavior consistent with that of non-temporary tables and avoids confusion. --- mysql-test/r/innodb_mysql.result | 21 ++++++++++++++++++++ mysql-test/r/temp_table.result | 16 ++++++++++++++++ mysql-test/t/innodb_mysql.test | 41 ++++++++++++++++++++++++++++++++++++++++ mysql-test/t/temp_table.test | 31 ++++++++++++++++++++++++++++++ sql/sql_base.cc | 23 +++++++++++++++++++++- 5 files changed, 131 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 075b4f84f2d..a1116a78bda 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -1767,4 +1767,25 @@ ref NULL rows 6 Extra Using where; Using index DROP TABLE foo, bar, foo2; +DROP TABLE IF EXISTS t1,t3,t2; +DROP FUNCTION IF EXISTS f1; +CREATE FUNCTION f1() RETURNS VARCHAR(250) +BEGIN +return 'hhhhhhh' ; +END| +CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB; +BEGIN WORK; +CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB; +CREATE TEMPORARY TABLE t3 LIKE t2; +INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL); +SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl'); +PREPARE stmt1 FROM @stmt; +SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2'); +PREPARE stmt3 FROM @stmt; +EXECUTE stmt1; +COMMIT; +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt3; +DROP TABLE t1,t3,t2; +DROP FUNCTION f1; End of 5.1 tests diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 6df09463d02..ba6b9f81a2d 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -194,4 +194,20 @@ DELETE FROM t1; SELECT * FROM t1; a b DROP TABLE t1; +DROP TABLE IF EXISTS t1,t2; +DROP FUNCTION IF EXISTS f1; +CREATE TEMPORARY TABLE t1 (a INT); +CREATE TEMPORARY TABLE t2 LIKE t1; +CREATE FUNCTION f1() RETURNS INT +BEGIN +return 1; +END| +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t1 SELECT f1(); +CREATE TABLE t3 SELECT * FROM t1; +INSERT INTO t1 SELECT f1(); +UPDATE t1,t2 SET t1.a = t2.a; +INSERT INTO t2 SELECT f1(); +DROP TABLE t1,t2,t3; +DROP FUNCTION f1; End of 5.1 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 1f9c08ac43b..5a2e115a98d 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -91,4 +91,45 @@ INSERT INTO foo2 SELECT * FROM foo; DROP TABLE foo, bar, foo2; +# +# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table +# + +--disable_warnings +DROP TABLE IF EXISTS t1,t3,t2; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +DELIMITER |; +CREATE FUNCTION f1() RETURNS VARCHAR(250) + BEGIN + return 'hhhhhhh' ; + END| +DELIMITER ;| + +CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20), c VARCHAR(20)) ENGINE=INNODB; + +BEGIN WORK; + +CREATE TEMPORARY TABLE t2 (a VARCHAR(20), b VARCHAR(20), c varchar(20)) ENGINE=INNODB; +CREATE TEMPORARY TABLE t3 LIKE t2; + +INSERT INTO t1 VALUES ('a','b',NULL),('c','d',NULL),('e','f',NULL); + +SET @stmt := CONCAT('INSERT INTO t2 SELECT tbl.a, tbl.b, f1()',' FROM t1 tbl'); +PREPARE stmt1 FROM @stmt; + +SET @stmt := CONCAT('INSERT INTO t3', ' SELECT * FROM t2'); +PREPARE stmt3 FROM @stmt; + +EXECUTE stmt1; + +COMMIT; + +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt3; + +DROP TABLE t1,t3,t2; +DROP FUNCTION f1; + --echo End of 5.1 tests diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 4ab8a982e63..2bfa4936c91 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -204,4 +204,35 @@ DELETE FROM t1; SELECT * FROM t1; DROP TABLE t1; +# +# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table +# + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +CREATE TEMPORARY TABLE t1 (a INT); +CREATE TEMPORARY TABLE t2 LIKE t1; + +DELIMITER |; +CREATE FUNCTION f1() RETURNS INT + BEGIN + return 1; + END| +DELIMITER ;| + +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t1 SELECT f1(); + +CREATE TABLE t3 SELECT * FROM t1; +INSERT INTO t1 SELECT f1(); + +UPDATE t1,t2 SET t1.a = t2.a; +INSERT INTO t2 SELECT f1(); + +DROP TABLE t1,t2,t3; +DROP FUNCTION f1; + --echo End of 5.1 tests diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ea664cd5091..6db9f1df0f2 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1111,6 +1111,27 @@ static void mark_temp_tables_as_free_for_reuse(THD *thd) */ if (table->child_l || table->parent) detach_merge_children(table, TRUE); + /* + Reset temporary table lock type to it's default value (TL_WRITE). + + Statements such as INSERT INTO .. SELECT FROM tmp, CREATE TABLE + .. SELECT FROM tmp and UPDATE may under some circumstances modify + the lock type of the tables participating in the statement. This + isn't a problem for non-temporary tables since their lock type is + reset at every open, but the same does not occur for temporary + tables for historical reasons. + + Furthermore, the lock type of temporary tables is not really that + important because they can only be used by one query at a time and + not even twice in a query -- a temporary table is represented by + only one TABLE object. Nonetheless, it's safer from a maintenance + point of view to reset the lock type of this singleton TABLE object + as to not cause problems when the table is reused. + + Even under LOCK TABLES mode its okay to reset the lock type as + LOCK TABLES is allowed (but ignored) for a temporary table. + */ + table->reginfo.lock_type= TL_WRITE; } } } @@ -4681,7 +4702,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) else if (tables->lock_type == TL_READ_DEFAULT) tables->table->reginfo.lock_type= read_lock_type_for_table(thd, tables->table); - else if (tables->table->s->tmp_table == NO_TMP_TABLE) + else tables->table->reginfo.lock_type= tables->lock_type; } tables->table->grant= tables->grant; -- cgit v1.2.1 From 4bd55050adb67b35a4c15c327d06a52535811fe7 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 7 Jan 2009 13:44:32 +0100 Subject: fix misspelling --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 022dbdbe7e3..1e9d942b1dd 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -230,7 +230,7 @@ extern "C" sig_handler handle_segfault(int sig); #if defined(__linux__) #define ENABLE_TEMP_POOL 1 #else -#define ENABLE_TEMP_TOOL 0 +#define ENABLE_TEMP_POOL 0 #endif /* Constants */ -- cgit v1.2.1 From a97db2bb7dbbceae4ed2599ad8b6847ca9a283ca Mon Sep 17 00:00:00 2001 From: Matthias Leich Date: Wed, 7 Jan 2009 22:38:03 +0100 Subject: Fix of Bug#41932 funcs_1: is_collation_character_set_applicability path too long for tar --- .../suite/funcs_1/r/is_coll_char_set_appl.result | 76 ++++++++++++++ ...is_collation_character_set_applicability.result | 76 -------------- .../suite/funcs_1/t/is_coll_char_set_appl.test | 113 +++++++++++++++++++++ .../is_collation_character_set_applicability.test | 113 --------------------- 4 files changed, 189 insertions(+), 189 deletions(-) create mode 100644 mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result delete mode 100644 mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result create mode 100644 mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test delete mode 100644 mysql-test/suite/funcs_1/t/is_collation_character_set_applicability.test diff --git a/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result b/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result new file mode 100644 index 00000000000..7eba964bdf6 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_coll_char_set_appl.result @@ -0,0 +1,76 @@ +SHOW TABLES FROM information_schema LIKE 'COLLATION_CHARACTER_SET_APPLICABILITY'; +Tables_in_information_schema (COLLATION_CHARACTER_SET_APPLICABILITY) +COLLATION_CHARACTER_SET_APPLICABILITY +####################################################################### +# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT +####################################################################### +DROP VIEW IF EXISTS test.v1; +DROP PROCEDURE IF EXISTS test.p1; +DROP FUNCTION IF EXISTS test.f1; +CREATE VIEW test.v1 AS SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; +CREATE PROCEDURE test.p1() SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; +CREATE FUNCTION test.f1() returns BIGINT +BEGIN +DECLARE counter BIGINT DEFAULT NULL; +SELECT COUNT(*) INTO counter FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; +RETURN counter; +END// +# Attention: The printing of the next result sets is disabled. +SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; +SELECT * FROM test.v1; +CALL test.p1; +SELECT test.f1(); +DROP VIEW test.v1; +DROP PROCEDURE test.p1; +DROP FUNCTION test.f1; +######################################################################### +# Testcase 3.2.4.1: INFORMATION_SCHEMA.CHARACTER_SET_APPLICABILITY layout +######################################################################### +DESCRIBE information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; +Field Type Null Key Default Extra +COLLATION_NAME varchar(32) NO +CHARACTER_SET_NAME varchar(32) NO +SHOW CREATE TABLE information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; +Table Create Table +COLLATION_CHARACTER_SET_APPLICABILITY CREATE TEMPORARY TABLE `COLLATION_CHARACTER_SET_APPLICABILITY` ( + `COLLATION_NAME` varchar(32) NOT NULL DEFAULT '', + `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '' +) ENGINE=MEMORY DEFAULT CHARSET=utf8 +SHOW COLUMNS FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; +Field Type Null Key Default Extra +COLLATION_NAME varchar(32) NO +CHARACTER_SET_NAME varchar(32) NO +# Testcases 3.2.4.2 and 3.2.4.3 are checked in suite/funcs_1/t/charset_collation*.test +######################################################################## +# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and +# DDL on INFORMATION_SCHEMA tables are not supported +######################################################################## +DROP DATABASE IF EXISTS db_datadict; +CREATE DATABASE db_datadict; +INSERT INTO information_schema.collation_character_set_applicability +SELECT * FROM information_schema.collation_character_set_applicability; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.collation_character_set_applicability +SET collation_name = 'big6_chinese_ci' WHERE character_set_name = 'big6'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +UPDATE information_schema.collation_character_set_applicability +SET character_set_name = 't_4711'; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DELETE FROM information_schema.collation_character_set_applicability; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +TRUNCATE information_schema.collation_character_set_applicability; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +CREATE INDEX my_idx +ON information_schema.collation_character_set_applicability(collation_name); +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.collation_character_set_applicability ADD f1 INT; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP TABLE information_schema.collation_character_set_applicability; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.collation_character_set_applicability +RENAME db_datadict.collation_character_set_applicability; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +ALTER TABLE information_schema.collation_character_set_applicability +RENAME information_schema.xcollation_character_set_applicability; +ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' +DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result b/mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result deleted file mode 100644 index 7eba964bdf6..00000000000 --- a/mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result +++ /dev/null @@ -1,76 +0,0 @@ -SHOW TABLES FROM information_schema LIKE 'COLLATION_CHARACTER_SET_APPLICABILITY'; -Tables_in_information_schema (COLLATION_CHARACTER_SET_APPLICABILITY) -COLLATION_CHARACTER_SET_APPLICABILITY -####################################################################### -# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT -####################################################################### -DROP VIEW IF EXISTS test.v1; -DROP PROCEDURE IF EXISTS test.p1; -DROP FUNCTION IF EXISTS test.f1; -CREATE VIEW test.v1 AS SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; -CREATE PROCEDURE test.p1() SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; -CREATE FUNCTION test.f1() returns BIGINT -BEGIN -DECLARE counter BIGINT DEFAULT NULL; -SELECT COUNT(*) INTO counter FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; -RETURN counter; -END// -# Attention: The printing of the next result sets is disabled. -SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; -SELECT * FROM test.v1; -CALL test.p1; -SELECT test.f1(); -DROP VIEW test.v1; -DROP PROCEDURE test.p1; -DROP FUNCTION test.f1; -######################################################################### -# Testcase 3.2.4.1: INFORMATION_SCHEMA.CHARACTER_SET_APPLICABILITY layout -######################################################################### -DESCRIBE information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; -Field Type Null Key Default Extra -COLLATION_NAME varchar(32) NO -CHARACTER_SET_NAME varchar(32) NO -SHOW CREATE TABLE information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; -Table Create Table -COLLATION_CHARACTER_SET_APPLICABILITY CREATE TEMPORARY TABLE `COLLATION_CHARACTER_SET_APPLICABILITY` ( - `COLLATION_NAME` varchar(32) NOT NULL DEFAULT '', - `CHARACTER_SET_NAME` varchar(32) NOT NULL DEFAULT '' -) ENGINE=MEMORY DEFAULT CHARSET=utf8 -SHOW COLUMNS FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY; -Field Type Null Key Default Extra -COLLATION_NAME varchar(32) NO -CHARACTER_SET_NAME varchar(32) NO -# Testcases 3.2.4.2 and 3.2.4.3 are checked in suite/funcs_1/t/charset_collation*.test -######################################################################## -# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and -# DDL on INFORMATION_SCHEMA tables are not supported -######################################################################## -DROP DATABASE IF EXISTS db_datadict; -CREATE DATABASE db_datadict; -INSERT INTO information_schema.collation_character_set_applicability -SELECT * FROM information_schema.collation_character_set_applicability; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -UPDATE information_schema.collation_character_set_applicability -SET collation_name = 'big6_chinese_ci' WHERE character_set_name = 'big6'; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -UPDATE information_schema.collation_character_set_applicability -SET character_set_name = 't_4711'; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -DELETE FROM information_schema.collation_character_set_applicability; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -TRUNCATE information_schema.collation_character_set_applicability; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -CREATE INDEX my_idx -ON information_schema.collation_character_set_applicability(collation_name); -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -ALTER TABLE information_schema.collation_character_set_applicability ADD f1 INT; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -DROP TABLE information_schema.collation_character_set_applicability; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -ALTER TABLE information_schema.collation_character_set_applicability -RENAME db_datadict.collation_character_set_applicability; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -ALTER TABLE information_schema.collation_character_set_applicability -RENAME information_schema.xcollation_character_set_applicability; -ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' -DROP DATABASE db_datadict; diff --git a/mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test b/mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test new file mode 100644 index 00000000000..2175de5d25a --- /dev/null +++ b/mysql-test/suite/funcs_1/t/is_coll_char_set_appl.test @@ -0,0 +1,113 @@ +# suite/funcs_1/t/is_coll_char_set_appl.test +# +# Check the layout of information_schema.collation_character_set_applicability +# and some functionality realted tests. +# +# Author: +# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of +# testsuite funcs_1 +# Create this script based on older scripts and new code. +# + +if (`SELECT VERSION() LIKE '%embedded%'`) +{ + --skip Bug#37456 funcs_1: Several tests crash when used with embedded server +} + +let $is_table = COLLATION_CHARACTER_SET_APPLICABILITY; + +# The table INFORMATION_SCHEMA.CHARACTER_SET_APPLICABILITY must exist +eval SHOW TABLES FROM information_schema LIKE '$is_table'; + +--echo ####################################################################### +--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT +--echo ####################################################################### +# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT +# statement, just as if it were an ordinary user-defined table. +# +--source suite/funcs_1/datadict/is_table_query.inc + + +--echo ######################################################################### +--echo # Testcase 3.2.4.1: INFORMATION_SCHEMA.CHARACTER_SET_APPLICABILITY layout +--echo ######################################################################### +# Ensure that the INFORMATION_SCHEMA.CHARACTER_SET_APPLICABILITY table has the +# following columns, in the following order: +# +# COLLATION_NAME (shows the name of a collation), +# CHARACTER_SET_NAME (shows the name of a character set to which that +# collation applies). +# +eval DESCRIBE information_schema.$is_table; +eval SHOW CREATE TABLE information_schema.$is_table; +eval SHOW COLUMNS FROM information_schema.$is_table; + +# Note: Retrieval of information within information_schema.columns about +# information_schema.collation_character_set_applicability is in +# is_columns_is.test. +# Retrieval of information_schema.collation_character_set_applicability +# content is in charset_collation.inc (sourced by charset_collation_*.test). + +echo # Testcases 3.2.4.2 and 3.2.4.3 are checked in suite/funcs_1/t/charset_collation*.test; + +--echo ######################################################################## +--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and +--echo # DDL on INFORMATION_SCHEMA tables are not supported +--echo ######################################################################## +# 3.2.1.3: Ensure that no user may execute an INSERT statement on any +# INFORMATION_SCHEMA table. +# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any +# INFORMATION_SCHEMA table. +# 3.2.1.5: Ensure that no user may execute a DELETE statement on any +# INFORMATION_SCHEMA table. +# 3.2.1.8: Ensure that no user may create an index on an +# INFORMATION_SCHEMA table. +# 3.2.1.9: Ensure that no user may alter the definition of an +# INFORMATION_SCHEMA table. +# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table. +# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any +# other database. +# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data +# in an INFORMATION_SCHEMA table. +# +--disable_warnings +DROP DATABASE IF EXISTS db_datadict; +--enable_warnings +CREATE DATABASE db_datadict; + +--error ER_DBACCESS_DENIED_ERROR +INSERT INTO information_schema.collation_character_set_applicability +SELECT * FROM information_schema.collation_character_set_applicability; + +--error ER_DBACCESS_DENIED_ERROR +UPDATE information_schema.collation_character_set_applicability +SET collation_name = 'big6_chinese_ci' WHERE character_set_name = 'big6'; +--error ER_DBACCESS_DENIED_ERROR +UPDATE information_schema.collation_character_set_applicability +SET character_set_name = 't_4711'; + +--error ER_DBACCESS_DENIED_ERROR +DELETE FROM information_schema.collation_character_set_applicability; +--error ER_DBACCESS_DENIED_ERROR +TRUNCATE information_schema.collation_character_set_applicability; + +--error ER_DBACCESS_DENIED_ERROR +CREATE INDEX my_idx +ON information_schema.collation_character_set_applicability(collation_name); + +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.collation_character_set_applicability ADD f1 INT; + +--error ER_DBACCESS_DENIED_ERROR +DROP TABLE information_schema.collation_character_set_applicability; + +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.collation_character_set_applicability +RENAME db_datadict.collation_character_set_applicability; +--error ER_DBACCESS_DENIED_ERROR +ALTER TABLE information_schema.collation_character_set_applicability +RENAME information_schema.xcollation_character_set_applicability; + +# Cleanup +DROP DATABASE db_datadict; + diff --git a/mysql-test/suite/funcs_1/t/is_collation_character_set_applicability.test b/mysql-test/suite/funcs_1/t/is_collation_character_set_applicability.test deleted file mode 100644 index cda7b578aae..00000000000 --- a/mysql-test/suite/funcs_1/t/is_collation_character_set_applicability.test +++ /dev/null @@ -1,113 +0,0 @@ -# suite/funcs_1/t/is_collation_character_set_applicability.test -# -# Check the layout of information_schema.collation_character_set_applicability -# and some functionality realted tests. -# -# Author: -# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of -# testsuite funcs_1 -# Create this script based on older scripts and new code. -# - -if (`SELECT VERSION() LIKE '%embedded%'`) -{ - --skip Bug#37456 funcs_1: Several tests crash when used with embedded server -} - -let $is_table = COLLATION_CHARACTER_SET_APPLICABILITY; - -# The table INFORMATION_SCHEMA.CHARACTER_SET_APPLICABILITY must exist -eval SHOW TABLES FROM information_schema LIKE '$is_table'; - ---echo ####################################################################### ---echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT ---echo ####################################################################### -# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT -# statement, just as if it were an ordinary user-defined table. -# ---source suite/funcs_1/datadict/is_table_query.inc - - ---echo ######################################################################### ---echo # Testcase 3.2.4.1: INFORMATION_SCHEMA.CHARACTER_SET_APPLICABILITY layout ---echo ######################################################################### -# Ensure that the INFORMATION_SCHEMA.CHARACTER_SET_APPLICABILITY table has the -# following columns, in the following order: -# -# COLLATION_NAME (shows the name of a collation), -# CHARACTER_SET_NAME (shows the name of a character set to which that -# collation applies). -# -eval DESCRIBE information_schema.$is_table; -eval SHOW CREATE TABLE information_schema.$is_table; -eval SHOW COLUMNS FROM information_schema.$is_table; - -# Note: Retrieval of information within information_schema.columns about -# information_schema.collation_character_set_applicability is in -# is_columns_is.test. -# Retrieval of information_schema.collation_character_set_applicability -# content is in charset_collation.inc (sourced by charset_collation_*.test). - -echo # Testcases 3.2.4.2 and 3.2.4.3 are checked in suite/funcs_1/t/charset_collation*.test; - ---echo ######################################################################## ---echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and ---echo # DDL on INFORMATION_SCHEMA tables are not supported ---echo ######################################################################## -# 3.2.1.3: Ensure that no user may execute an INSERT statement on any -# INFORMATION_SCHEMA table. -# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any -# INFORMATION_SCHEMA table. -# 3.2.1.5: Ensure that no user may execute a DELETE statement on any -# INFORMATION_SCHEMA table. -# 3.2.1.8: Ensure that no user may create an index on an -# INFORMATION_SCHEMA table. -# 3.2.1.9: Ensure that no user may alter the definition of an -# INFORMATION_SCHEMA table. -# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table. -# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any -# other database. -# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data -# in an INFORMATION_SCHEMA table. -# ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; - ---error ER_DBACCESS_DENIED_ERROR -INSERT INTO information_schema.collation_character_set_applicability -SELECT * FROM information_schema.collation_character_set_applicability; - ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.collation_character_set_applicability -SET collation_name = 'big6_chinese_ci' WHERE character_set_name = 'big6'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.collation_character_set_applicability -SET character_set_name = 't_4711'; - ---error ER_DBACCESS_DENIED_ERROR -DELETE FROM information_schema.collation_character_set_applicability; ---error ER_DBACCESS_DENIED_ERROR -TRUNCATE information_schema.collation_character_set_applicability; - ---error ER_DBACCESS_DENIED_ERROR -CREATE INDEX my_idx -ON information_schema.collation_character_set_applicability(collation_name); - ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.collation_character_set_applicability ADD f1 INT; - ---error ER_DBACCESS_DENIED_ERROR -DROP TABLE information_schema.collation_character_set_applicability; - ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.collation_character_set_applicability -RENAME db_datadict.collation_character_set_applicability; ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.collation_character_set_applicability -RENAME information_schema.xcollation_character_set_applicability; - -# Cleanup -DROP DATABASE db_datadict; - -- cgit v1.2.1 From 88cd7a98a5b52cd9a7c7568c864f73342f0f4d35 Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Thu, 8 Jan 2009 03:06:54 +0100 Subject: Fix a few problems after latest bunch of InnoDB snapshot changes: The binlog_innodb test was sensitive to what tests ran before it. Now run FLUSH STATUS before performing operations that need to be checked. sys_var_thd_ulong::update() was improperly casting an option value from ulonglong to ulong before comparing it to the max allowed value. On systems where ulong and ulonglong are of different size, this caused values greater than ULONG_MAX to wrap around (not be truncated to ULONG_MAX, which appears to have been the intention of the original coder), and caused some checks to work incorrectly. This wasn't generally visible to the user, because later checks would prevent the wrapped-around value from being used. But it caused warning messages to differ between 32- and 64-bit platforms. Fix is to just remove the cast. Also added a DBUG_ASSERT to ensure that the value really is capped properly before finally stuffing it into the ulong. --- mysql-test/suite/binlog/r/binlog_innodb.result | 7 ++++--- mysql-test/suite/binlog/t/binlog_innodb.test | 1 + sql/set_var.cc | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result index 896d8f734fc..919ac33ef35 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_innodb.result @@ -113,16 +113,17 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ DROP TABLE t1; +flush status; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 13 +Binlog_cache_use 0 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 0 create table t1 (a int) engine=innodb; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 14 +Binlog_cache_use 1 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 @@ -131,7 +132,7 @@ delete from t1; commit; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 15 +Binlog_cache_use 2 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 diff --git a/mysql-test/suite/binlog/t/binlog_innodb.test b/mysql-test/suite/binlog/t/binlog_innodb.test index df99e3786ee..f84fd65226a 100644 --- a/mysql-test/suite/binlog/t/binlog_innodb.test +++ b/mysql-test/suite/binlog/t/binlog_innodb.test @@ -101,6 +101,7 @@ DROP TABLE t1; # Actually this test has nothing to do with innodb per se, it just requires # transactional table. # +flush status; show status like "binlog_cache_use"; show status like "binlog_cache_disk_use"; diff --git a/sql/set_var.cc b/sql/set_var.cc index a371c1113ef..308735f52f2 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1527,14 +1527,14 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var) ulonglong tmp= var->save_result.ulonglong_value; /* Don't use bigger value than given with --maximum-variable-name=.. */ - if ((ulong) tmp > max_system_variables.*offset) + if (tmp > max_system_variables.*offset) { throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) tmp); tmp= max_system_variables.*offset; } if (option_limits) - tmp= (ulong) fix_unsigned(thd, tmp, option_limits); + tmp= fix_unsigned(thd, tmp, option_limits); #if SIZEOF_LONG < SIZEOF_LONG_LONG else if (tmp > ULONG_MAX) { @@ -1543,6 +1543,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var) } #endif + DBUG_ASSERT(tmp <= ULONG_MAX); if (var->type == OPT_GLOBAL) global_system_variables.*offset= (ulong) tmp; else -- cgit v1.2.1 From c42892d61413adea81c174a90d458c07a8ddd52c Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Thu, 8 Jan 2009 10:25:31 +0100 Subject: Bug#41470: DATE_FORMAT() crashes the complete server with a valid date Passing dubious "year zero" in non-zero date (not "0000-00-00") could lead to negative value for year internally, while variable was unsigned. This led to Really Bad Things further down the line. Now doing calculations with signed type for year internally. mysql-test/r/date_formats.result: show that very early dates no longer break DATE_FORMAT(..., '%W') mysql-test/t/date_formats.test: show that very early dates no longer break DATE_FORMAT(..., '%W') sql-common/my_time.c: Allow negative years numbers internally while keeping the interface. otherwise if somebody passes year zero for whatever reason, we'll get an integer wrap-around that can lead to Really Bad Things further down the line. Note that amusingly, calcday_nr() already had signed output and calc_weekday() already had signed input, anyway. --- mysql-test/r/date_formats.result | 10 ++++++++++ mysql-test/t/date_formats.test | 12 ++++++++++++ sql-common/my_time.c | 13 +++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 6833a7f1594..43f656e3c99 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -593,3 +593,13 @@ select str_to_date('04/30/2004 ', '%m/%d/%Y '); str_to_date('04/30/2004 ', '%m/%d/%Y ') 2004-04-30 "End of 4.1 tests" +SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date; +valid_date +Sunday 01 January 0000 +SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date; +valid_date +Tuesday 28 February 0000 +SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; +valid_date +Thursday 01 January 2009 +"End of 5.0 tests" diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index faa6d4242db..0c02398acc1 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -337,3 +337,15 @@ select str_to_date('04/30 /2004', '%m /%d /%Y'); select str_to_date('04/30/2004 ', '%m/%d/%Y '); --echo "End of 4.1 tests" + +# +# Bug #41470: DATE_FORMAT() crashes the complete server with a valid date +# + +# show that these two do not crash the server: +SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date; +SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date; +# show that date within the Gregorian range render correct results: (THU) +SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; + +--echo "End of 5.0 tests" diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 1781251fca1..16a64ebd947 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -765,19 +765,20 @@ long calc_daynr(uint year,uint month,uint day) { long delsum; int temp; + int y= year; /* may be < 0 temporarily */ DBUG_ENTER("calc_daynr"); - if (year == 0 && month == 0 && day == 0) + if (y == 0 && month == 0 && day == 0) DBUG_RETURN(0); /* Skip errors */ - delsum= (long) (365L * year+ 31*(month-1) +day); + delsum= (long) (365L * y+ 31*(month-1) +day); if (month <= 2) - year--; + y--; else delsum-= (long) (month*4+23)/10; - temp=(int) ((year/100+1)*3)/4; + temp=(int) ((y/100+1)*3)/4; DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld", - year+(month <= 2),month,day,delsum+year/4-temp)); - DBUG_RETURN(delsum+(int) year/4-temp); + y+(month <= 2),month,day,delsum+y/4-temp)); + DBUG_RETURN(delsum+(int) y/4-temp); } /* calc_daynr */ -- cgit v1.2.1 From f7e77185600f51107f4795db7ba8c405d7b707a5 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Thu, 8 Jan 2009 10:31:34 -0200 Subject: Bug#41889: Test main.innodb_bug38231 is failing w/embedded server (server crash) The problem is that a mysql connection instance is not thread-safe and reentrant, meaning that it can't be used concurrently and can't be re-entered while it's already running. This applies for any form of the server (embedded or not), but this rule can be violated in a test case if the test sends a new command without waiting for the result of previous command that was sent asynchronously and this can lead to hangs when over a network or to crashes under embedded server as the server query execution path will be re-entered concurrently with the same connection structure. The solution is to rework the test case so that the aforementioned rule is obeyed. mysql-test/t/innodb_bug38231.test: Remove con3 as it is not necessary to reproduce the test case and might cause problems as there is no guarantee on which LOCK TABLE request will succeed first. Also, wait for statement result before sending a new one on the same connection. --- mysql-test/t/innodb_bug38231.test | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test index 5b87969f062..b3fcd89f371 100644 --- a/mysql-test/t/innodb_bug38231.test +++ b/mysql-test/t/innodb_bug38231.test @@ -16,7 +16,6 @@ CREATE TABLE bug38231 (a INT); -- connect (con1,localhost,root,,) -- connect (con2,localhost,root,,) --- connect (con3,localhost,root,,) -- connection con1 SET autocommit=0; @@ -27,11 +26,6 @@ SET autocommit=0; -- send LOCK TABLE bug38231 WRITE; --- connection con3 -SET autocommit=0; --- send -LOCK TABLE bug38231 WRITE; - -- connection default -- send TRUNCATE TABLE bug38231; @@ -39,6 +33,7 @@ TRUNCATE TABLE bug38231; -- connection con1 # give time to TRUNCATE and others to be executed; without sleep, sometimes # UNLOCK executes before TRUNCATE +# TODO: Replace with wait_condition once possible under embedded server. -- sleep 0.2 # this crashes the server if the bug is present UNLOCK TABLES; @@ -46,16 +41,13 @@ UNLOCK TABLES; # clean up -- connection con2 -UNLOCK TABLES; - --- connection con3 +-- reap UNLOCK TABLES; -- connection default - +-- reap -- disconnect con1 -- disconnect con2 --- disconnect con3 # test that TRUNCATE works with with row-level locks -- cgit v1.2.1 From 4e5177268ad5b29c4b44767a648cb1662603cc68 Mon Sep 17 00:00:00 2001 From: Horst Hunger Date: Thu, 8 Jan 2009 19:13:57 +0100 Subject: Patch for bug#36875: Inserted review results. --- mysql-test/include/have_32bit.inc | 2 +- mysql-test/include/have_64bit.inc | 2 +- .../suite/sys_vars/inc/sort_buffer_size_basic.inc | 52 +++++++++++++------ .../sys_vars/r/sort_buffer_size_basic_32.result | 60 +++++++++++----------- .../sys_vars/r/sort_buffer_size_basic_64.result | 60 +++++++++++----------- 5 files changed, 97 insertions(+), 79 deletions(-) diff --git a/mysql-test/include/have_32bit.inc b/mysql-test/include/have_32bit.inc index b09a813967d..66684fb5325 100644 --- a/mysql-test/include/have_32bit.inc +++ b/mysql-test/include/have_32bit.inc @@ -11,6 +11,6 @@ eval SET @@global.sort_buffer_size = $save; --enable_query_log if (!$mach32) { - skip Need a 32 bit machine; + skip Need a 32 bit machine/binary; } diff --git a/mysql-test/include/have_64bit.inc b/mysql-test/include/have_64bit.inc index 31529a0c9d4..cbba5e1d338 100644 --- a/mysql-test/include/have_64bit.inc +++ b/mysql-test/include/have_64bit.inc @@ -9,6 +9,6 @@ eval SET @@session.sort_buffer_size = $save; --enable_query_log if (!$mach64) { - skip Need a 64 bit machine; + skip Need a 64 binary ; } diff --git a/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc b/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc index 10acf709386..19d8b442c2c 100644 --- a/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc +++ b/mysql-test/suite/sys_vars/inc/sort_buffer_size_basic.inc @@ -40,9 +40,12 @@ # Save initial value # ############################################################# -# due to differences when running on Windows (bug filed) +# due to differences when running on Windows (Bug#36695) --source include/not_windows.inc +let $kbrange32 = BETWEEN 32776 AND 32999; +let $mbrange2 = BETWEEN 2097116 AND 2100000; + --disable_warnings SET @start_global_value = @@global.sort_buffer_size; @@ -55,11 +58,13 @@ SET @start_session_value = @@session.sort_buffer_size; SET @@global.sort_buffer_size = 1000; SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; +eval +SELECT @@global.sort_buffer_size $mbrange2; SET @@session.sort_buffer_size = 2000; SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; +eval +SELECT @@session.sort_buffer_size $mbrange2; --echo '#--------------------FN_DYNVARS_151_02-------------------------#' @@ -68,10 +73,12 @@ SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 30 ###################################################################### SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; +eval +SELECT @@global.sort_buffer_size $mbrange2; SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; +eval +SELECT @@session.sort_buffer_size $mbrange2; --echo '#--------------------FN_DYNVARS_151_03-------------------------#' @@ -80,9 +87,11 @@ SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 30 ################################################################################ SET @@global.sort_buffer_size = 32776; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = 32777; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; SET @@global.sort_buffer_size = 4294967294; @@ -94,9 +103,11 @@ SELECT @@global.sort_buffer_size; ################################################################################### SET @@session.sort_buffer_size = 32776; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +eval +SELECT @@session.sort_buffer_size $kbrange32; SET @@session.sort_buffer_size = 32777; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +eval +SELECT @@session.sort_buffer_size $kbrange32; SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; SET @@session.sort_buffer_size = 4294967294; @@ -109,9 +120,11 @@ SELECT @@session.sort_buffer_size; ################################################################## SET @@global.sort_buffer_size = 32775; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = -1024; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = 4294967296; SELECT @@global.sort_buffer_size; --Error ER_PARSE_ERROR @@ -122,9 +135,11 @@ SET @@global.sort_buffer_size = test; SELECT @@global.sort_buffer_size; SET @@session.sort_buffer_size = 32775; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +eval +SELECT @@session.sort_buffer_size $kbrange32; SET @@session.sort_buffer_size = -2; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; +eval +SELECT @@session.sort_buffer_size $kbrange32; --Error ER_PARSE_ERROR SET @@session.sort_buffer_size = 65530.34.; SET @@session.sort_buffer_size = 4294967296; @@ -148,7 +163,7 @@ SELECT @@global.sort_buffer_size = VARIABLE_VALUE FROM #################################################################### SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM - INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; +INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; --echo '#------------------FN_DYNVARS_151_08-----------------------#' @@ -157,9 +172,11 @@ SELECT @@session.sort_buffer_size = VARIABLE_VALUE FROM #################################################################### SET @@global.sort_buffer_size = TRUE; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +eval +SELECT @@global.sort_buffer_size $kbrange32; SET @@global.sort_buffer_size = FALSE; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; +eval +SELECT @@global.sort_buffer_size $kbrange32; --echo '#---------------------FN_DYNVARS_151_09----------------------#' #################################################################################### @@ -185,7 +202,8 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; ################################################################################### SET sort_buffer_size = 9100; -SELECT @@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000; +eval +SELECT @@sort_buffer_size $kbrange32; --Error ER_UNKNOWN_TABLE SELECT local.sort_buffer_size; --Error ER_UNKNOWN_TABLE diff --git a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result index 353ea9dee8c..9d3eadcc26f 100644 --- a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_32.result @@ -3,31 +3,31 @@ SET @start_session_value = @@session.sort_buffer_size; '#--------------------FN_DYNVARS_151_01-------------------------#' SET @@global.sort_buffer_size = 1000; SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; -@@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000 +SELECT @@global.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@global.sort_buffer_size BETWEEN 2097116 AND 2100000 1 SET @@session.sort_buffer_size = 2000; SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; -@@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000 +SELECT @@session.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@session.sort_buffer_size BETWEEN 2097116 AND 2100000 1 '#--------------------FN_DYNVARS_151_02-------------------------#' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; -@@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000 +SELECT @@global.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@global.sort_buffer_size BETWEEN 2097116 AND 2100000 1 SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; -@@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000 +SELECT @@session.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@session.sort_buffer_size BETWEEN 2097116 AND 2100000 1 '#--------------------FN_DYNVARS_151_03-------------------------#' SET @@global.sort_buffer_size = 32776; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 32777; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; @@ -39,12 +39,12 @@ SELECT @@global.sort_buffer_size; 4294967294 '#--------------------FN_DYNVARS_151_04-------------------------#' SET @@session.sort_buffer_size = 32776; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; -@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 32777; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; -@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; @@ -56,12 +56,12 @@ SELECT @@session.sort_buffer_size; 4294967294 '#------------------FN_DYNVARS_151_05-----------------------#' SET @@global.sort_buffer_size = 32775; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = -1024; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 4294967296; SELECT @@global.sort_buffer_size; @@ -78,12 +78,12 @@ SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967295 SET @@session.sort_buffer_size = 32775; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; -@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = -2; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; -@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 @@ -105,12 +105,12 @@ INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; 1 '#------------------FN_DYNVARS_151_08-----------------------#' SET @@global.sort_buffer_size = TRUE; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = FALSE; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 '#---------------------FN_DYNVARS_151_09----------------------#' SET @@global.sort_buffer_size = 9000; @@ -127,8 +127,8 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; 1 '#---------------------FN_DYNVARS_151_11----------------------#' SET sort_buffer_size = 9100; -SELECT @@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000; -@@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000 +SELECT @@sort_buffer_size BETWEEN 32776 AND 32999; +@@sort_buffer_size BETWEEN 32776 AND 32999 1 SELECT local.sort_buffer_size; ERROR 42S02: Unknown table 'local' in field list diff --git a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result index 3708f88f889..c993c8a0a88 100644 --- a/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result +++ b/mysql-test/suite/sys_vars/r/sort_buffer_size_basic_64.result @@ -3,31 +3,31 @@ SET @start_session_value = @@session.sort_buffer_size; '#--------------------FN_DYNVARS_151_01-------------------------#' SET @@global.sort_buffer_size = 1000; SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; -@@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000 +SELECT @@global.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@global.sort_buffer_size BETWEEN 2097116 AND 2100000 1 SET @@session.sort_buffer_size = 2000; SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; -@@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000 +SELECT @@session.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@session.sort_buffer_size BETWEEN 2097116 AND 2100000 1 '#--------------------FN_DYNVARS_151_02-------------------------#' SET @@global.sort_buffer_size = DEFAULT; -SELECT @@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000; -@@global.sort_buffer_size >= 2097116 AND @@global.sort_buffer_size < 3000000 +SELECT @@global.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@global.sort_buffer_size BETWEEN 2097116 AND 2100000 1 SET @@session.sort_buffer_size = DEFAULT; -SELECT @@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000; -@@session.sort_buffer_size >= 2097116 AND @@session.sort_buffer_size < 3000000 +SELECT @@session.sort_buffer_size BETWEEN 2097116 AND 2100000; +@@session.sort_buffer_size BETWEEN 2097116 AND 2100000 1 '#--------------------FN_DYNVARS_151_03-------------------------#' SET @@global.sort_buffer_size = 32776; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 32777; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 4294967295; SELECT @@global.sort_buffer_size; @@ -39,12 +39,12 @@ SELECT @@global.sort_buffer_size; 4294967294 '#--------------------FN_DYNVARS_151_04-------------------------#' SET @@session.sort_buffer_size = 32776; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; -@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 32777; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; -@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 4294967295; SELECT @@session.sort_buffer_size; @@ -56,12 +56,12 @@ SELECT @@session.sort_buffer_size; 4294967294 '#------------------FN_DYNVARS_151_05-----------------------#' SET @@global.sort_buffer_size = 32775; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = -1024; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = 4294967296; SELECT @@global.sort_buffer_size; @@ -78,12 +78,12 @@ SELECT @@global.sort_buffer_size; @@global.sort_buffer_size 4294967296 SET @@session.sort_buffer_size = 32775; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; -@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = -2; -SELECT @@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000; -@@session.sort_buffer_size >= 32776 AND @@session.sort_buffer_size < 33000 +SELECT @@session.sort_buffer_size BETWEEN 32776 AND 32999; +@@session.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@session.sort_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 @@ -105,12 +105,12 @@ INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sort_buffer_size'; 1 '#------------------FN_DYNVARS_151_08-----------------------#' SET @@global.sort_buffer_size = TRUE; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 SET @@global.sort_buffer_size = FALSE; -SELECT @@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000; -@@global.sort_buffer_size >= 32776 AND @@global.sort_buffer_size < 33000 +SELECT @@global.sort_buffer_size BETWEEN 32776 AND 32999; +@@global.sort_buffer_size BETWEEN 32776 AND 32999 1 '#---------------------FN_DYNVARS_151_09----------------------#' SET @@global.sort_buffer_size = 9000; @@ -127,8 +127,8 @@ SELECT @@local.sort_buffer_size = @@session.sort_buffer_size; 1 '#---------------------FN_DYNVARS_151_11----------------------#' SET sort_buffer_size = 9100; -SELECT @@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000; -@@sort_buffer_size >= 32776 AND @@sort_buffer_size < 33000 +SELECT @@sort_buffer_size BETWEEN 32776 AND 32999; +@@sort_buffer_size BETWEEN 32776 AND 32999 1 SELECT local.sort_buffer_size; ERROR 42S02: Unknown table 'local' in field list -- cgit v1.2.1 From 5c92f27f63b0bd97448474fb26329504810fb978 Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Fri, 9 Jan 2009 10:48:01 +0100 Subject: BUG#41961: Some log_event types do not skip post-header when reading Problem: when the server reads a log_event from file, it should read the post-header lengths from the format_description_log_event. Some event types which currently have post-header length 0 did not do this, and instead had a hard-coded zero length for the post-header. That means the current server version will not be able to read future versions of these events. Fix: make the reader functions read the post-header. sql/log_event.cc: - Made Format_description_log_event constructor initialize all post-header lengths explicitly, to make it easier to find them in the source code. - After this, it is no longer necessary to pass the MY_ZEROFILL flag to my_malloc. I removed the flag and added a sanity-check that will be executed only in debug-mode. - Made INTVAR, RAND, USER_VAR, and XID events skip post_header_len when reading from file. sql/log_event.h: Added explicit defines for the lengths of all event types. --- sql/log_event.cc | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- sql/log_event.h | 8 ++++++++ 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 74ad018df55..3d6585778cf 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3425,7 +3425,8 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) number_of_event_types= LOG_EVENT_TYPES; /* we'll catch my_malloc() error in is_valid() */ post_header_len=(uint8*) my_malloc(number_of_event_types*sizeof(uint8), - MYF(MY_ZEROFILL)); + MYF(0)); + /* This long list of assignments is not beautiful, but I see no way to make it nicer, as the right members are #defines, not array members, so @@ -3433,16 +3434,40 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) */ if (post_header_len) { + // Allows us to sanity-check that all events initialized their + // events (see the end of this 'if' block). + IF_DBUG(memset(post_header_len, 255, + number_of_event_types*sizeof(uint8));); + + /* Note: all event types must explicitly fill in their lengths here. */ post_header_len[START_EVENT_V3-1]= START_V3_HEADER_LEN; post_header_len[QUERY_EVENT-1]= QUERY_HEADER_LEN; + post_header_len[STOP_EVENT-1]= STOP_HEADER_LEN; post_header_len[ROTATE_EVENT-1]= ROTATE_HEADER_LEN; + post_header_len[INTVAR_EVENT-1]= INTVAR_HEADER_LEN; post_header_len[LOAD_EVENT-1]= LOAD_HEADER_LEN; + post_header_len[SLAVE_EVENT-1]= SLAVE_HEADER_LEN; post_header_len[CREATE_FILE_EVENT-1]= CREATE_FILE_HEADER_LEN; post_header_len[APPEND_BLOCK_EVENT-1]= APPEND_BLOCK_HEADER_LEN; post_header_len[EXEC_LOAD_EVENT-1]= EXEC_LOAD_HEADER_LEN; post_header_len[DELETE_FILE_EVENT-1]= DELETE_FILE_HEADER_LEN; - post_header_len[NEW_LOAD_EVENT-1]= post_header_len[LOAD_EVENT-1]; + post_header_len[NEW_LOAD_EVENT-1]= NEW_LOAD_HEADER_LEN; + post_header_len[RAND_EVENT-1]= RAND_HEADER_LEN; + post_header_len[USER_VAR_EVENT-1]= USER_VAR_HEADER_LEN; post_header_len[FORMAT_DESCRIPTION_EVENT-1]= FORMAT_DESCRIPTION_HEADER_LEN; + post_header_len[XID_EVENT-1]= XID_HEADER_LEN; + post_header_len[BEGIN_LOAD_QUERY_EVENT-1]= BEGIN_LOAD_QUERY_HEADER_LEN; + post_header_len[EXECUTE_LOAD_QUERY_EVENT-1]= EXECUTE_LOAD_QUERY_HEADER_LEN; + /* + The PRE_GA events are never be written to any binlog, but + their lengths are included in Format_description_log_event. + Hence, we need to be assign some value here, to avoid reading + uninitialized memory when the array is written to disk. + */ + post_header_len[PRE_GA_WRITE_ROWS_EVENT-1] = 0; + post_header_len[PRE_GA_UPDATE_ROWS_EVENT-1] = 0; + post_header_len[PRE_GA_DELETE_ROWS_EVENT-1] = 0; + post_header_len[TABLE_MAP_EVENT-1]= TABLE_MAP_HEADER_LEN; post_header_len[WRITE_ROWS_EVENT-1]= ROWS_HEADER_LEN; post_header_len[UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN; @@ -3462,9 +3487,14 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) post_header_len[WRITE_ROWS_EVENT-1]= post_header_len[UPDATE_ROWS_EVENT-1]= post_header_len[DELETE_ROWS_EVENT-1]= 6;); - post_header_len[BEGIN_LOAD_QUERY_EVENT-1]= post_header_len[APPEND_BLOCK_EVENT-1]; - post_header_len[EXECUTE_LOAD_QUERY_EVENT-1]= EXECUTE_LOAD_QUERY_HEADER_LEN; post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN; + + // Sanity-check that all post header lengths are initialized. + IF_DBUG({ + int i; + for (i=0; icommon_header_len; + /* The Post-Header is empty. The Varible Data part begins immediately. */ + buf+= description_event->common_header_len + + description_event->post_header_len[INTVAR_EVENT-1]; type= buf[I_TYPE_OFFSET]; val= uint8korr(buf+I_VAL_OFFSET); } @@ -4957,7 +4989,9 @@ Rand_log_event::Rand_log_event(const char* buf, const Format_description_log_event* description_event) :Log_event(buf, description_event) { - buf+= description_event->common_header_len; + /* The Post-Header is empty. The Variable Data part begins immediately. */ + buf+= description_event->common_header_len + + description_event->post_header_len[RAND_EVENT-1]; seed1= uint8korr(buf+RAND_SEED1_OFFSET); seed2= uint8korr(buf+RAND_SEED2_OFFSET); } @@ -5061,7 +5095,9 @@ Xid_log_event(const char* buf, const Format_description_log_event *description_event) :Log_event(buf, description_event) { - buf+= description_event->common_header_len; + /* The Post-Header is empty. The Variable Data part begins immediately. */ + buf+= description_event->common_header_len + + description_event->post_header_len[XID_EVENT-1]; memcpy((char*) &xid, buf, sizeof(xid)); } @@ -5207,7 +5243,9 @@ User_var_log_event(const char* buf, const Format_description_log_event* description_event) :Log_event(buf, description_event) { - buf+= description_event->common_header_len; + /* The Post-Header is empty. The Variable Data part begins immediately. */ + buf+= description_event->common_header_len + + description_event->post_header_len[USER_VAR_EVENT-1]; name_len= uint4korr(buf); name= (char *) buf + UV_NAME_LEN_SIZE; buf+= UV_NAME_LEN_SIZE + name_len; diff --git a/sql/log_event.h b/sql/log_event.h index db14341b51d..185d2d21a02 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -227,14 +227,22 @@ struct sql_ex_info #define QUERY_HEADER_MINIMAL_LEN (4 + 4 + 1 + 2) // where 5.0 differs: 2 for len of N-bytes vars. #define QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 2) +#define STOP_HEADER_LEN 0 #define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4) +#define SLAVE_HEADER_LEN 0 #define START_V3_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4) #define ROTATE_HEADER_LEN 8 // this is FROZEN (the Rotate post-header is frozen) +#define INTVAR_HEADER_LEN 0 #define CREATE_FILE_HEADER_LEN 4 #define APPEND_BLOCK_HEADER_LEN 4 #define EXEC_LOAD_HEADER_LEN 4 #define DELETE_FILE_HEADER_LEN 4 +#define NEW_LOAD_HEADER_LEN LOAD_HEADER_LEN +#define RAND_HEADER_LEN 0 +#define USER_VAR_HEADER_LEN 0 #define FORMAT_DESCRIPTION_HEADER_LEN (START_V3_HEADER_LEN+1+LOG_EVENT_TYPES) +#define XID_HEADER_LEN 0 +#define BEGIN_LOAD_QUERY_HEADER_LEN APPEND_BLOCK_HEADER_LEN #define ROWS_HEADER_LEN 8 #define TABLE_MAP_HEADER_LEN 8 #define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1) -- cgit v1.2.1 From 8dbb9c885d42fd03b997a507d10620c1a55fa44d Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Fri, 9 Jan 2009 08:20:32 -0200 Subject: Bug#37016: TRUNCATE TABLE removes some rows but not all The special TRUNCATE TABLE (DDL) transaction wasn't being properly rolled back if a error occurred during row by row deletion. The error can be caused by a foreign key restriction imposed by InnoDB SE and would cause the server to erroneously issue a implicit commit. The solution is to rollback the transaction if a truncation via row by row deletion fails, otherwise commit. All effects of a TRUNCATE ABLE operation are rolled back if a row by row deletion fails. mysql-test/include/commit.inc: Truncate always starts a transaction and commits at the end. The commit at the end increases the count by two, one is the storage engine commit and the other is the binary log. mysql-test/r/commit_1innodb.result: Update test case results. mysql-test/r/innodb_mysql.result: Update test case results. mysql-test/t/innodb_mysql.test: Add test case for Bug#37016 sql/sql_delete.cc: Move truncation using row by row deletion to its own function. If row by row deletion fails, rollback the transaction. Remove the meddling with disabling and enabling of autocommit as TRUNCATE transaction is now explicitly ended (committed or rolled back). --- mysql-test/include/commit.inc | 6 ++-- mysql-test/r/commit_1innodb.result | 6 ++-- mysql-test/r/innodb_mysql.result | 58 ++++++++++++++++++++++++++++++++++++++ mysql-test/t/innodb_mysql.test | 52 ++++++++++++++++++++++++++++++++++ sql/sql_delete.cc | 40 +++++++++++++------------- 5 files changed, 137 insertions(+), 25 deletions(-) diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index 48b0eac12e5..de5eca8b1f6 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -617,10 +617,10 @@ call p_verify_status_increment(0, 0, 0, 0); --echo --echo # No test because of Bug#8729 "rename table fails on temporary table" ---echo # 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction +--echo # 24. DDL: TRUNCATE TEMPORARY TABLE --echo truncate table t2; -call p_verify_status_increment(2, 0, 2, 0); +call p_verify_status_increment(4, 0, 4, 0); commit; --echo # There is nothing left to commit call p_verify_status_increment(0, 0, 0, 0); @@ -733,7 +733,7 @@ call p_verify_status_increment(1, 0, 1, 0); rename table t4 to t3; call p_verify_status_increment(1, 0, 1, 0); truncate table t3; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(4, 4, 2, 2); create view v1 as select * from t2; call p_verify_status_increment(1, 0, 1, 0); check table t1; diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index 766b920f630..72e6b01bb03 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -683,10 +683,10 @@ SUCCESS # 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction # No test because of Bug#8729 "rename table fails on temporary table" -# 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction +# 24. DDL: TRUNCATE TEMPORARY TABLE truncate table t2; -call p_verify_status_increment(2, 0, 2, 0); +call p_verify_status_increment(4, 0, 4, 0); SUCCESS commit; @@ -853,7 +853,7 @@ call p_verify_status_increment(1, 0, 1, 0); SUCCESS truncate table t3; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(4, 4, 2, 2); SUCCESS create view v1 as select * from t2; diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index a1116a78bda..6fcc9415d12 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -1788,4 +1788,62 @@ DEALLOCATE PREPARE stmt1; DEALLOCATE PREPARE stmt3; DROP TABLE t1,t3,t2; DROP FUNCTION f1; +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, +t1_id INT, INDEX par_ind (t1_id), +FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (3,2); +SET AUTOCOMMIT = 0; +START TRANSACTION; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +COMMIT; +SELECT * FROM t1; +id +1 +2 +START TRANSACTION; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +ROLLBACK; +SELECT * FROM t1; +id +1 +2 +SET AUTOCOMMIT = 1; +START TRANSACTION; +SELECT * FROM t1; +id +1 +2 +COMMIT; +TRUNCATE TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`)) +SELECT * FROM t1; +id +1 +2 +DELETE FROM t2 WHERE id = 3; +START TRANSACTION; +SELECT * FROM t1; +id +1 +2 +TRUNCATE TABLE t1; +ROLLBACK; +SELECT * FROM t1; +id +TRUNCATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 5a2e115a98d..21ee440f10b 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -132,4 +132,56 @@ DEALLOCATE PREPARE stmt3; DROP TABLE t1,t3,t2; DROP FUNCTION f1; +# +# Bug#37016: TRUNCATE TABLE removes some rows but not all +# + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + +CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; +CREATE TABLE t2 (id INT PRIMARY KEY, + t1_id INT, INDEX par_ind (t1_id), + FOREIGN KEY (t1_id) REFERENCES t1(id)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (3,2); + +SET AUTOCOMMIT = 0; + +START TRANSACTION; +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +COMMIT; +SELECT * FROM t1; + +START TRANSACTION; +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +ROLLBACK; +SELECT * FROM t1; + +SET AUTOCOMMIT = 1; + +START TRANSACTION; +SELECT * FROM t1; +COMMIT; + +--error ER_ROW_IS_REFERENCED_2 +TRUNCATE TABLE t1; +SELECT * FROM t1; +DELETE FROM t2 WHERE id = 3; + +START TRANSACTION; +SELECT * FROM t1; +TRUNCATE TABLE t1; +ROLLBACK; +SELECT * FROM t1; +TRUNCATE TABLE t2; + +DROP TABLE t2; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index f7c44152571..b56e042e3d5 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -950,6 +950,26 @@ bool multi_delete::send_eof() TRUNCATE TABLE ****************************************************************************/ +/* + Row-by-row truncation if the engine does not support table recreation. + Probably a InnoDB table. +*/ + +static bool mysql_truncate_by_delete(THD *thd, TABLE_LIST *table_list) +{ + bool error, save_binlog_row_based= thd->current_stmt_binlog_row_based; + DBUG_ENTER("mysql_truncate_by_delete"); + table_list->lock_type= TL_WRITE; + mysql_init_select(thd->lex); + thd->clear_current_stmt_binlog_row_based(); + error= mysql_delete(thd, table_list, NULL, NULL, HA_POS_ERROR, LL(0), TRUE); + ha_autocommit_or_rollback(thd, error); + end_trans(thd, error ? ROLLBACK : COMMIT); + thd->current_stmt_binlog_row_based= save_binlog_row_based; + DBUG_RETURN(error); +} + + /* Optimize delete of all rows by doing a full generate of the table This will work even if the .ISM and .ISD tables are destroyed @@ -1055,24 +1075,6 @@ end: DBUG_RETURN(error); trunc_by_del: - /* Probably InnoDB table */ - ulonglong save_options= thd->options; - table_list->lock_type= TL_WRITE; - thd->options&= ~(OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT); - ha_enable_transaction(thd, FALSE); - mysql_init_select(thd->lex); - bool save_binlog_row_based= thd->current_stmt_binlog_row_based; - thd->clear_current_stmt_binlog_row_based(); - error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0, - HA_POS_ERROR, LL(0), TRUE); - ha_enable_transaction(thd, TRUE); - /* - Safety, in case the engine ignored ha_enable_transaction(FALSE) - above. Also clears thd->transaction.*. - */ - error= ha_autocommit_or_rollback(thd, error); - ha_commit(thd); - thd->options= save_options; - thd->current_stmt_binlog_row_based= save_binlog_row_based; + error= mysql_truncate_by_delete(thd, table_list); DBUG_RETURN(error); } -- cgit v1.2.1 From ac885d5dfbe4c094f693851433516265a57868d6 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Jan 2009 13:50:18 +0200 Subject: Bug #41437: Value stored in 'case' lacks charset, causes segfault When substituting system constant functions with a constant result the server was not expecting that the function may return NULL. Fixed by checking for NULL and returning Item_null (in the relevant collation) if the result of the system constant function was NULL. mysql-test/r/mysql.result: Bug #41437: test case mysql-test/t/mysql.test: Bug #41437: test case. Relies on database() returning NULL if no database is selected. sql/item_strfunc.cc: Bug #41437: Check for NULL result on evaluating the system constant function and return a constant NULL item. --- mysql-test/r/mysql.result | 2 ++ mysql-test/t/mysql.test | 5 +++++ sql/item_strfunc.cc | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 95bdcab6ba1..9bad3b9f791 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -186,4 +186,6 @@ delimiter 2 2 2 +@z:='1' @z=database() +1 NULL End of 5.0 tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 76941af893a..68a01a309d4 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -309,4 +309,9 @@ EOF --exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql; +# +# Bug #41437: Value stored in 'case' lacks charset, causees segfault +# +--exec $MYSQL -e "select @z:='1',@z=database()" + --echo End of 5.0 tests diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index d1e3f45bba1..34f974042a5 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1696,6 +1696,12 @@ Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs) Item_string *conv; uint conv_errors; String tmp, cstr, *ostr= val_str(&tmp); + if (null_value) + { + Item *null_item= new Item_null((char *) fully_qualified_func_name()); + null_item->collation.set (tocs); + return null_item; + } cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors); if (conv_errors || !(conv= new Item_static_string_func(fully_qualified_func_name(), -- cgit v1.2.1 From 5f4585626d47cd49cb897b4510856751ff1edc6f Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Jan 2009 14:04:47 +0200 Subject: Bug #41543: Assertion `m_status == DA_ERROR' failed in Diagnostics_area::sql_errno No need to mask the error code returned by getting the next row to end of file when doing filesort. mysql-test/r/innodb_mysql_rbk.result: Bug #41543: test case mysql-test/t/innodb_mysql_rbk-master.opt: Bug #41543: test case mysql-test/t/innodb_mysql_rbk.test: Bug #41543: test case sql/filesort.cc: Bug #41543: No need to mask the error code returned by getting the next row to end of file when doing filesort. --- mysql-test/r/innodb_mysql_rbk.result | 21 +++++++++++++++++++ mysql-test/t/innodb_mysql_rbk-master.opt | 1 + mysql-test/t/innodb_mysql_rbk.test | 35 ++++++++++++++++++++++++++++++++ sql/filesort.cc | 3 --- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 mysql-test/r/innodb_mysql_rbk.result create mode 100644 mysql-test/t/innodb_mysql_rbk-master.opt create mode 100644 mysql-test/t/innodb_mysql_rbk.test diff --git a/mysql-test/r/innodb_mysql_rbk.result b/mysql-test/r/innodb_mysql_rbk.result new file mode 100644 index 00000000000..21ac4295325 --- /dev/null +++ b/mysql-test/r/innodb_mysql_rbk.result @@ -0,0 +1,21 @@ +CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb +DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +a b +3 3 +START TRANSACTION; +UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ROLLBACK; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +a b +3 3 +START TRANSACTION; +UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT * FROM t1 WHERE b = 10; +a b +DROP TABLE t1; diff --git a/mysql-test/t/innodb_mysql_rbk-master.opt b/mysql-test/t/innodb_mysql_rbk-master.opt new file mode 100644 index 00000000000..0e400f9c36b --- /dev/null +++ b/mysql-test/t/innodb_mysql_rbk-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=1 --innodb_rollback_on_timeout=1 diff --git a/mysql-test/t/innodb_mysql_rbk.test b/mysql-test/t/innodb_mysql_rbk.test new file mode 100644 index 00000000000..d2368c81f95 --- /dev/null +++ b/mysql-test/t/innodb_mysql_rbk.test @@ -0,0 +1,35 @@ +-- source include/have_innodb.inc + +# +# Bug #41453: Assertion `m_status == DA_ERROR' failed in +# Diagnostics_area::sql_errno +# + +CREATE TABLE t1(a INT, b INT NOT NULL, PRIMARY KEY (a)) ENGINE=innodb +DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +CONNECT (con1,localhost,root,,); +CONNECT (con2,localhost,root,,); + +CONNECTION con1; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +CONNECTION con2; +START TRANSACTION; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET b=b+12 WHERE a > 2 ORDER BY a; +ROLLBACK; + +CONNECTION con1; +START TRANSACTION; +SELECT * FROM t1 WHERE b=3 LIMIT 1 FOR UPDATE; +CONNECTION con2; +START TRANSACTION; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET b=10 WHERE a > 1 ORDER BY a; +SELECT * FROM t1 WHERE b = 10; + +CONNECTION default; +DISCONNECT con1; +DISCONNECT con2; +DROP TABLE t1; diff --git a/sql/filesort.cc b/sql/filesort.cc index 2850ada1ffb..5d8b4e869c8 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -562,10 +562,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, if (quick_select) { if ((error= select->quick->get_next())) - { - error= HA_ERR_END_OF_FILE; break; - } file->position(sort_form->record[0]); DBUG_EXECUTE_IF("debug_filesort", dbug_print_record(sort_form, TRUE);); } -- cgit v1.2.1 From 8576423de864d532e82bfabbd314d040852fd56b Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Fri, 9 Jan 2009 13:49:24 +0100 Subject: BUG#41924: high-level replication functions are not commented Adding comments to some of the high-level functions in replication. sql/log_event.h: Fixed some mistakes in comments. sql/repl_failsafe.cc: Added comment for show_slave_hosts() sql/slave.cc: Added comment for show_master_info(), handle_slave_[sql|io](), and next_event() sql/sql_binlog.cc: Added @param comment. sql/sql_lex.h: Added comment for st_lex_master_info. sql/sql_repl.cc: Added comments for functions executing a statement: PURGE BINARY LOGS START SLAVE STOP SLAVE RESET SLAVE CHANGE MASTER RESET MASTER SHOW BINLOG EVENTS SHOW MASTER STATUS SHOW BINARY LOGS --- sql/log_event.h | 22 +++++---- sql/repl_failsafe.cc | 10 +++++ sql/slave.cc | 39 ++++++++++++++-- sql/sql_binlog.cc | 5 ++- sql/sql_lex.h | 9 ++++ sql/sql_repl.cc | 123 ++++++++++++++++++++++++++++++++++++++++++--------- 6 files changed, 172 insertions(+), 36 deletions(-) diff --git a/sql/log_event.h b/sql/log_event.h index 185d2d21a02..e546cff8b7b 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -327,18 +327,16 @@ struct sql_ex_info #define Q_CHARSET_DATABASE_CODE 8 #define Q_TABLE_MAP_FOR_UPDATE_CODE 9 -/* Intvar event post-header */ +/* Intvar event data */ #define I_TYPE_OFFSET 0 #define I_VAL_OFFSET 1 -/* Rand event post-header */ - +/* Rand event data */ #define RAND_SEED1_OFFSET 0 #define RAND_SEED2_OFFSET 8 -/* User_var event post-header */ - +/* User_var event data */ #define UV_VAL_LEN_SIZE 4 #define UV_VAL_IS_NULL 1 #define UV_VAL_TYPE_SIZE 1 @@ -346,7 +344,6 @@ struct sql_ex_info #define UV_CHARSET_NUMBER_SIZE 4 /* Load event post-header */ - #define L_THREAD_ID_OFFSET 0 #define L_EXEC_TIME_OFFSET 4 #define L_SKIP_LINES_OFFSET 8 @@ -357,7 +354,6 @@ struct sql_ex_info #define L_DATA_OFFSET LOAD_HEADER_LEN /* Rotate event post-header */ - #define R_POS_OFFSET 0 #define R_IDENT_OFFSET 8 @@ -2214,10 +2210,11 @@ protected: @section Intvar_log_event_binary_format Binary Format - The Post-Header has two components: + The Post-Header for this event type is empty. The Body has two + components: - + @@ -2291,11 +2288,12 @@ private: which are stored internally as two 64-bit numbers. @section Rand_log_event_binary_format Binary Format - This event type has no Post-Header. The Body of this event type has - two components: + + The Post-Header for this event type is empty. The Body has two + components:
Post-Header for Intvar_log_eventBody for Intvar_log_event
Name
- + diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index d7e783f534f..582348608de 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -644,6 +644,16 @@ err: } #endif + +/** + Execute a SHOW SLAVE HOSTS statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @retval FALSE success + @retval TRUE failure +*/ bool show_slave_hosts(THD* thd) { List field_list; diff --git a/sql/slave.cc b/sql/slave.cc index 43b70f29a68..22c61b3ec6c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1357,6 +1357,17 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi, } +/** + Execute a SHOW SLAVE STATUS statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param mi Pointer to Master_info object for the IO thread. + + @retval FALSE success + @retval TRUE failure +*/ bool show_master_info(THD* thd, Master_info* mi) { // TODO: fix this for multi-master @@ -2062,7 +2073,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, Relay_log_info* rli, fewer times, 0 is returned. - init_master_info or init_relay_log_pos failed. (These are called - if a failure occurs when applying the event.) + if a failure occurs when applying the event.) - An error occurred when updating the binlog position. @@ -2307,8 +2318,14 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, } -/* Slave I/O Thread entry point */ +/** + Slave IO thread entry point. + + @param arg Pointer to Master_info struct that holds information for + the IO thread. + @return Always 0. +*/ pthread_handler_t handle_slave_io(void *arg) { THD *thd; // needs to be first for thread_stack @@ -2616,8 +2633,14 @@ err: } -/* Slave SQL Thread entry point */ +/** + Slave SQL thread entry point. + + @param arg Pointer to Relay_log_info object that holds information + for the SQL thread. + @return Always 0. +*/ pthread_handler_t handle_slave_sql(void *arg) { THD *thd; /* needs to be first for thread_stack */ @@ -3710,6 +3733,16 @@ static IO_CACHE *reopen_relay_log(Relay_log_info *rli, const char **errmsg) } +/** + Reads next event from the relay log. Should be called from the + slave IO thread. + + @param rli Relay_log_info structure for the slave IO thread. + + @return The event read, or NULL on error. If an error occurs, the + error is reported through the sql_print_information() or + sql_print_error() functions. +*/ static Log_event* next_event(Relay_log_info* rli) { Log_event* ev; diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index 7ca7bef3a56..96e99b57e3c 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -18,7 +18,7 @@ #include "base64.h" /** - Execute a BINLOG statement + Execute a BINLOG statement. To execute the BINLOG command properly the server needs to know which format the BINLOG command's event is in. Therefore, the first @@ -26,6 +26,9 @@ Format_description_log_event, as outputted by mysqlbinlog. This Format_description_log_event is cached in rli->description_event_for_exec. + + @param thd Pointer to THD object for the client thread executing the + statement. */ void mysql_client_binlog_statement(THD* thd) diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 26bd8d18750..ed6b9e7d8df 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -190,6 +190,15 @@ typedef struct st_lex_server_options char *server_name, *host, *db, *username, *password, *scheme, *socket, *owner; } LEX_SERVER_OPTIONS; + +/** + Structure to hold parameters for CHANGE MASTER or START/STOP SLAVE + or SHOW NEW MASTER. + + Remark: this should not be confused with Master_info (and perhaps + would better be renamed to st_lex_replication_info). Some fields, + e.g., delay, are saved in Relay_log_info, not in Master_info. +*/ typedef struct st_lex_master_info { char *host, *user, *password, *log_file_name; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index eac7a50417a..646bfdaefe8 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -257,6 +257,17 @@ bool purge_error_message(THD* thd, int res) } +/** + Execute a PURGE BINARY LOGS TO command. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param to_log Name of the last log to purge. + + @retval FALSE success + @retval TRUE failure +*/ bool purge_master_logs(THD* thd, const char* to_log) { char search_file_name[FN_REFLEN]; @@ -273,6 +284,17 @@ bool purge_master_logs(THD* thd, const char* to_log) } +/** + Execute a PURGE BINARY LOGS BEFORE command. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param purge_time Date before which logs should be purged. + + @retval FALSE success + @retval TRUE failure +*/ bool purge_master_logs_before_date(THD* thd, time_t purge_time) { if (!mysql_bin_log.is_open()) @@ -765,6 +787,20 @@ err: DBUG_VOID_RETURN; } + +/** + Execute a START SLAVE statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param mi Pointer to Master_info object for the slave's IO thread. + + @param net_report If true, saves the exit status into thd->main_da. + + @retval 0 success + @retval 1 error +*/ int start_slave(THD* thd , Master_info* mi, bool net_report) { int slave_errno= 0; @@ -890,6 +926,19 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) } +/** + Execute a STOP SLAVE statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param mi Pointer to Master_info object for the slave's IO thread. + + @param net_report If true, saves the exit status into thd->main_da. + + @retval 0 success + @retval 1 error +*/ int stop_slave(THD* thd, Master_info* mi, bool net_report ) { DBUG_ENTER("stop_slave"); @@ -942,20 +991,17 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report ) } -/* - Remove all relay logs and start replication from the start - - SYNOPSIS - reset_slave() - thd Thread handler - mi Master info for the slave +/** + Execute a RESET SLAVE statement. - RETURN - 0 ok - 1 error -*/ + @param thd Pointer to THD object of the client thread executing the + statement. + @param mi Pointer to Master_info object for the slave. + @retval 0 success + @retval 1 error +*/ int reset_slave(THD *thd, Master_info* mi) { MY_STAT stat_area; @@ -1070,6 +1116,18 @@ void kill_zombie_dump_threads(uint32 slave_server_id) } +/** + Execute a CHANGE MASTER statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @param mi Pointer to Master_info object belonging to the slave's IO + thread. + + @retval FALSE success + @retval TRUE error +*/ bool change_master(THD* thd, Master_info* mi) { int thread_mask; @@ -1283,6 +1341,16 @@ bool change_master(THD* thd, Master_info* mi) DBUG_RETURN(FALSE); } + +/** + Execute a RESET MASTER statement. + + @param thd Pointer to THD object of the client thread executing the + statement. + + @retval 0 success + @retval 1 error +*/ int reset_master(THD* thd) { if (!mysql_bin_log.is_open()) @@ -1312,6 +1380,15 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, } +/** + Execute a SHOW BINLOG EVENTS statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @retval FALSE success + @retval TRUE failure +*/ bool mysql_show_binlog_events(THD* thd) { Protocol *protocol= thd->protocol; @@ -1462,6 +1539,15 @@ err: } +/** + Execute a SHOW MASTER STATUS statement. + + @param thd Pointer to THD object for the client thread executing the + statement. + + @retval FALSE success + @retval TRUE failure +*/ bool show_binlog_info(THD* thd) { Protocol *protocol= thd->protocol; @@ -1495,18 +1581,15 @@ bool show_binlog_info(THD* thd) } -/* - Send a list of all binary logs to client +/** + Execute a SHOW BINARY LOGS statement. - SYNOPSIS - show_binlogs() - thd Thread specific variable + @param thd Pointer to THD object for the client thread executing the + statement. - RETURN VALUES - FALSE OK - TRUE error + @retval FALSE success + @retval TRUE failure */ - bool show_binlogs(THD* thd) { IO_CACHE *index_file; -- cgit v1.2.1 From efea2e68d8f35ab752219803815e6d3a7d3f523c Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Fri, 9 Jan 2009 14:18:08 +0100 Subject: Bug#40972: Partition pruning can lead to crash for bad dates post push fix, added test found a valgrind warning sql/sql_partition.cc: Bug#40972: Partition pruning can lead to crash for bad dates Fix for valgrind warning --- sql/sql_partition.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index ad24aa3c283..ae55c194c3c 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -6678,6 +6678,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, uint32 max_endpoint_val; get_endpoint_func get_endpoint; uint field_len= field->pack_length_in_rec(); + part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; if (part_info->part_type == RANGE_PARTITION) { @@ -6698,7 +6699,6 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, max_endpoint_val= part_info->no_list_values; part_iter->get_next= get_next_partition_id_list; part_iter->part_info= part_info; - part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; if (max_endpoint_val == 0) { /* -- cgit v1.2.1 From f0d1d53335fa72a910201f15741b275afab8f67d Mon Sep 17 00:00:00 2001 From: Matthias Leich Date: Fri, 9 Jan 2009 15:10:03 +0100 Subject: 1. Fix for Bug#41111 events_bugs fails sporadically on pushbuild 2. Avoid bad effects of bug 41925 Warning 1366 Incorrect string value: ... for column processlist.info 3. Add poll routines which ensure that subtests meet stable scenarios. This does not change the sense of the subtests. --- mysql-test/include/check_events_off.inc | 31 +++ mysql-test/include/no_running_event_scheduler.inc | 23 ++ mysql-test/include/no_running_events.inc | 25 ++ mysql-test/include/running_event_scheduler.inc | 30 +++ mysql-test/r/events_bugs.result | 27 ++- mysql-test/t/events_bugs.test | 272 +++++++++++++++++----- 6 files changed, 339 insertions(+), 69 deletions(-) create mode 100644 mysql-test/include/check_events_off.inc create mode 100644 mysql-test/include/no_running_event_scheduler.inc create mode 100644 mysql-test/include/no_running_events.inc create mode 100644 mysql-test/include/running_event_scheduler.inc diff --git a/mysql-test/include/check_events_off.inc b/mysql-test/include/check_events_off.inc new file mode 100644 index 00000000000..599a4b9e504 --- /dev/null +++ b/mysql-test/include/check_events_off.inc @@ -0,0 +1,31 @@ +########## include/check_events_off.inc #################################### +# # +# Purpose: # +# Wait till we can expect that we have no event activity till the scheduler is # +# switched on again. # +# = There will be no modifications of user tables by existing events # +# except they use "INSERT DELAYED" or the server system variable # +# "concurrent_inserts" is not switched off. # +# Only some storage engines support concurrent_inserts" or "INSERT DELAYED". # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for bug fixes in tests # +# # +################################################################################ + +# 1. Check that the server system variable shows the state needed +if (`SELECT @@global.event_scheduler <> 'OFF'`) +{ + --echo # Error: We expect here that the event scheduler is switched off. + SELECT @@global.event_scheduler; + --echo # Thinkable reasons: + --echo # 1. SET GLOBAL event_scheduler = OFF had not the expected effect. + --echo # 2. Use of the current routine (include/check_events_off.inc) + --echo # within the wrong situation + --die +} +# 2. Wait till we have no event_scheduler session within the processlist +--source include/no_running_event_scheduler.inc +# 3. Wait till we have no event executor sessions within the processlist +--source include/no_running_events.inc + diff --git a/mysql-test/include/no_running_event_scheduler.inc b/mysql-test/include/no_running_event_scheduler.inc new file mode 100644 index 00000000000..92813df9f96 --- /dev/null +++ b/mysql-test/include/no_running_event_scheduler.inc @@ -0,0 +1,23 @@ +########## include/no_running_event_scheduler.inc ########################## +# # +# Wait till the event scheduler disappeared from processlist. # +# # +# The characteristics of the event_scheduler entry within the processlist is # +# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if # +# ther is no short phase with command <> 'Daemon'. # +# A query with WHERE user = 'event_scheduler' only will also catch events in # +# startup phase. This is no problem since this phase is very short. # +# # +# A wait_timeout of >= 3 seconds was within experiments sufficient even on a # +# testing box with heavy parallel load. Therefore 5 seconds should be enough. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +let $wait_timeout= 5; +let $wait_condition= + SELECT COUNT(*) = 0 FROM information_schema.processlist + WHERE user = 'event_scheduler'; +--source include/wait_condition.inc diff --git a/mysql-test/include/no_running_events.inc b/mysql-test/include/no_running_events.inc new file mode 100644 index 00000000000..8090b2706b8 --- /dev/null +++ b/mysql-test/include/no_running_events.inc @@ -0,0 +1,25 @@ +########## include/no_running_events.inc ################################### +# # +# Wait till all event executors have finished their work. # +# # +# Different event executors share the characteristics that their entry within # +# processlist contains command = 'Connect'. # +# Of course the corresponding query will also catch other connections being # +# within the connect phase. This is no problem since the connect phase is # +# usually very short. # +# # +# A wait_timeout of >= 3 seconds was during experiments in case of "simple" # +# SQL commands sufficient even on a testing box with heavy parallel load. # +# "simple" = no sleeps, no long running commands, no waiting for lock ... # +# We use here the default of 30 seconds because this wastes some time only in # +# case of unexpected situations. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +let $wait_condition= + SELECT COUNT(*) = 0 FROM information_schema.processlist + WHERE command = 'Connect'; +--source include/wait_condition.inc diff --git a/mysql-test/include/running_event_scheduler.inc b/mysql-test/include/running_event_scheduler.inc new file mode 100644 index 00000000000..296bf842e82 --- /dev/null +++ b/mysql-test/include/running_event_scheduler.inc @@ -0,0 +1,30 @@ +############# include/running_event_scheduler.inc ########################## +# # +# Wait till the event scheduler reached its final state within the processlist.# +# # +# The characteristics of the event_scheduler entry within the processlist is # +# user = 'event_scheduler' and command = 'Daemon'. I am not 100% sure if # +# ther is no short phase with command <> 'Daemon'. # +# A query with WHERE user = 'event_scheduler' only will also catch events in # +# startup phase. # +# # +# Creation: # +# 2008-12-19 mleich Implement this check needed for test bug fixes # +# # +################################################################################ + +# 1. Check that the server system variable shows the state needed +if (`SELECT @@global.event_scheduler <> 'ON'`) +{ + --echo # Error: We expect here that the event scheduler is switched on. + SELECT @@global.event_scheduler; + --echo # Thinkable reasons: + --echo # 1. SET GLOBAL event_scheduler = ON had not the expected effect. + --echo # 2. Use of the current routine (include/running_event_scheduler.inc) + --echo # within the wrong situation + --die +} +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE user = 'event_scheduler' AND command = 'Daemon'; +--source include/wait_condition.inc diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index c698531dfec..f0fa1bc3efa 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -3,6 +3,8 @@ drop database if exists mysqltest_db1; drop database if exists mysqltest_db2; create database events_test; use events_test; +set @concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert = 0; select * from information_schema.global_variables where variable_name like 'event_scheduler'; VARIABLE_NAME VARIABLE_VALUE EVENT_SCHEDULER ON @@ -60,7 +62,7 @@ select get_lock('test_bug16407', 60); end| "Now if everything is fine the event has compiled and is locked" select /*1*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'test_bug16407\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)'; user host db info root localhost events_test select get_lock('test_bug16407', 60) select release_lock('test_bug16407'); @@ -84,7 +86,7 @@ get_lock('ee_16407_2', 60) set global event_scheduler= 1; "Another sql_mode test" set sql_mode="traditional"; -create table events_smode_test(ev_name char(10), a date) engine=myisam; +create table events_smode_test(ev_name char(10), a date); "This should never insert something" create event ee_16407_2 on schedule every 60 second do begin @@ -92,7 +94,7 @@ select get_lock('ee_16407_2', 60) /*ee_16407_2*/; select release_lock('ee_16407_2'); insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); end| -insert into events_smode_test values ('test','1980-19-02')| +insert into events_test.events_smode_test values ('test','1980-19-02')| ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1 "This is ok" create event ee_16407_3 on schedule every 60 second do @@ -116,7 +118,7 @@ events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER events_test ee_16407_4 select /*2*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'ee_16407_2\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; user host db info root localhost events_test select get_lock('ee_16407_2', 60) root localhost events_test select get_lock('ee_16407_2', 60) @@ -125,10 +127,10 @@ select release_lock('ee_16407_2'); release_lock('ee_16407_2') 1 select /*3*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'ee_16407_2\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; user host db info set global event_scheduler= off; -select * from events_smode_test order by ev_name, a; +select * from events_test.events_smode_test order by ev_name, a; ev_name a ee_16407_3 1980-02-19 ee_16407_3 1980-02-29 @@ -143,7 +145,7 @@ drop event ee_16407_2; drop event ee_16407_3; drop event ee_16407_4; "And now one last test regarding sql_mode and call of SP from an event" -delete from events_smode_test; +delete from events_test.events_smode_test; set sql_mode='ansi'; select get_lock('ee_16407_5', 60); get_lock('ee_16407_5', 60) @@ -166,10 +168,8 @@ call events_test.ee_16407_6_pendant(); end| "Should have 2 locked processes" select /*4*/ user, host, db, info from information_schema.processlist -where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') -order by info; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; user host db info -event_scheduler localhost NULL NULL root localhost events_test select get_lock('ee_16407_5', 60) root localhost events_test select get_lock('ee_16407_5', 60) select release_lock('ee_16407_5'); @@ -177,11 +177,9 @@ release_lock('ee_16407_5') 1 "Should have 0 processes locked" select /*5*/ user, host, db, info from information_schema.processlist -where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') -order by info; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; user host db info -event_scheduler localhost NULL NULL -select * from events_smode_test order by ev_name, a; +select * from events_test.events_smode_test order by ev_name, a; ev_name a ee_16407_6 2004-02-29 "And here we check one more time before we drop the events" @@ -740,3 +738,4 @@ name drop event e1; DROP DATABASE events_test; SET GLOBAL event_scheduler = 'ON'; +SET @@global.concurrent_insert = @concurrent_insert; diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index e86734c167c..d4b6e78ab3d 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -1,40 +1,133 @@ #### t/events_bugs.test # # Last change: -# 2008-10-16 mleich +# 2009-01-08 mleich # - Fix for -# Bug#39848 events_bugs fails sporadically on pushbuild -# (missing rows in table event_log) -# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes -# in I_S.PROCESSLIST) -# Bug#39978 main.events_bugs does not clean up -# Bug#39569 events_bugs fails sporadically on pushbuild (should have -# failed with errno 1539) -# - Minor improvements of formatting -# -# -# Outcome of some experiments (mleich): -# 1. SET GLOBAL event_scheduler = 'ON'; -# Immediate observation of the processlist. -# Effects: -# 1. There is no guarantee to find immediate the user 'event_scheduler' -# within information_schema.processlist. -# 2. Some states of the user 'event_scheduler' found in PROCESSLIST: -# USER HOST DB COMMAND TIME STATE INFO -# event_scheduler localhost NULL Daemon 0 Waiting on empty queue NULL -# event_scheduler localhost NULL Daemon 0 Initialized NULL +# Bug#41111 events_bugs fails sporadically on pushbuild +# - Avoid effects of +# Bug#41925 Warning 1366 Incorrect string value: ... for column processlist.info +# +# Please set $ +let $fixed_bug41925= 0; +# +# Dear maintainer of this test. Please do NOT remove the next big comment. +# The tests for events were quite unstable over a significant time because the +# effects of events in general and their representation within the processlist +# were partially not known. Therefore I had to make excessive experiments. +# The comment with the outcome of these experiments will be moved into a README +# file as soon as the tests for events get their own testsuite. +# +# Outcome of some experiments (mleich, mysql-5.1 2008-12): +# -------------------------------------------------------- +# 0. Most time used setup: +# High parallel I/O load +# set global event_scheduler= off; +# sleep 3; +# use events_test; +# create event e_16407 on schedule every 2 second do +# begin +# select 'FIRST COMMAND', sleep(0.5); +# select 'SECOND COMMAND'; +# end| +# set global event_scheduler= on; +# Start observation of the processlist +# +# +# 1. SET GLOBAL event_scheduler = 'ON' and immediate observation of the processlist. +# 1.1 Effects around event scheduler: +# 1.1.1 First phase (very short) +# No user 'event_scheduler' within information_schema.processlist. +# 1.1.2 Second phase observed (independend of probably existing events and very short) was +# USER HOST DB COMMAND TIME STATE INFO +# event_scheduler localhost NULL Daemon 0 Initialized NULL +# 1.1.3 Third phase observed: +# 1.1.3.1 Case we do not have existing events (rather long) +# USER HOST DB COMMAND TIME STATE INFO +# event_scheduler localhost NULL Daemon 0 Waiting on empty queue NULL +# 1.1.3.2 Case there exists already an event +# 1.1.3.2.1 Event executor is not visible in processlist but comes up soon +# USER HOST DB COMMAND TIME STATE INFO +# event_scheduler localhost NULL Daemon 0 NULL +# or +# event_scheduler localhost NULL Daemon 0 NULL NULL +# 1.1.3.2.2 A bit later, at least one event executor is or was visible in processlist +# The states mentioned in 3.2.1 or a bit later +# USER HOST DB COMMAND TIME STATE INFO +# event_scheduler localhost NULL Daemon 0 Waiting for next activation NULL +# 1.2 Effects around event executor: +# Typical processlist content: +# USER evtest1 -- Definer of event +# DB events_test -- DB during time of event creation (use DB is not allowed in events) +# COMMAND Connect +# STATE NULL +# INFO SET @evname = 'ev_sched_1823' -- Part of the event code +# +# State before "User sleep select 'FIRST COMMAND', sleep(0.5);" +# ID USER HOST DB COMMAND TIME STATE INFO +# 7 event_scheduler localhost NULL Connect 0 NULL NULL +# !! The user is not the event creator and the DB is different. !! +# !! This means that we must get later a change of the identity. !! +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 checking permissions +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 checking permissions CREATE PROCEDURE .... +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 NULL select 'FIRST COMMAND', sleep(0.5) +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 checking permissions select 'FIRST COMMAND'... +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 Opening table select 'FIRST COMMAND', sleep(0.5) +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 Locked select 'FIRST COMMAND', sleep(0.5) +# or +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 executing select 'FIRST COMMAND', sleep(0.5) +# +# State "User sleep select 'FIRST COMMAND', sleep(0.5);" reached +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 User sleep select 'FIRST COMMAND', sleep(0.5) +# +# State at end (! It looks like a slow CREATE PROC !) of event code execution was sometimes +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 logging slow query CREATE PROCEDURE `e_16407`... +# +# State after running some event code was sometimes +# USER HOST DB COMMAND TIME STATE INFO +# root localhost events_test Connect 0 logging slow query select 'SECOND COMMAND' +# +# State somewhere (I guess just before the event executor disappears) +# USER HOST DB COMMAND TIME STATE INFO +# Event thread fin events_test Connect 0 Clearing NULL +# +# # 2. SET GLOBAL event_scheduler = 'OFF'; # Immediate observation of the processlist. # Effects: # 1. I never found the user 'event_scheduler' within the processlist. # 2. Events just during execution could be found within the processlist # = It does not look like "SET GLOBAL event_scheduler = 'OFF'" stops them. -# 3. An event gets executed -# USER evtest1 (Definer of event) -# DB events_test (DB during time of event creation) -# COMMAND Connect -# STATE NULL -# INFO SET @evname = 'ev_sched_1823' (Part of the event code) +# ==> Everything mentioned in 1.2 above could be observed. +# +# Several subtests were weak because they showed random result set differences after issuing +# "SET GLOBAL EVENT_SCHEDULER= off;". +# 1. Reason one: There were already event executors +# Fix: Wait till there is no event executor active ==> no session WHERE +# - command IN ('Connect') +# There must be no parallel session being just in "Connect" phase! +# or +# - user = +# There must be no parallel session of this person. +# or user = 'event_scheduler' with command = 'Connect' +# The session which will soon change its identity to event creator. +# +# 2. Reason two: If an event modifies a MyISAM table than a delayed visibilty of changes +# might occur (concurrent_inserts=on or delayed inserts ...). # # Can't test with embedded server that doesn't support grants @@ -47,6 +140,10 @@ drop database if exists mysqltest_db2; --enable_warnings create database events_test; use events_test; +# We use MyISAM tables and must avoid effects (visibility of changes might be +# delayed) caused by concurrent_insert on (default). +set @concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert = 0; # # START: Bug #31332 --event-scheduler option misbehaving @@ -56,8 +153,11 @@ use events_test; # option with no argument in events_bugs-master.opt turns the scheduler on. select * from information_schema.global_variables where variable_name like 'event_scheduler'; +# Check that the event_scheduler is really running +--source include/running_event_scheduler.inc SET GLOBAL event_scheduler = 'OFF'; +--source include/check_events_off.inc # # END: Bug #31332 @@ -132,8 +232,10 @@ create event e_55 on schedule every 10 hour starts 10000101000000 do drop table # Start - 16407: Events: Changes in sql_mode won't be taken into account # set global event_scheduler=off; +--source include/check_events_off.inc delete from mysql.event; set global event_scheduler= on; +--source include/running_event_scheduler.inc set @old_sql_mode:=@@sql_mode; set sql_mode=ansi; select get_lock('test_bug16407', 60); @@ -148,13 +250,13 @@ delimiter ;| # We wait till one event runs and hangs when trying to get the user lock. let $wait_condition= select count(*) > 0 from information_schema.processlist - where info = 'select get_lock(\'test_bug16407\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)'; --source include/wait_condition.inc --echo "Now if everything is fine the event has compiled and is locked" # Expect to see one session in events_test waiting for the user lock. select /*1*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'test_bug16407\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)'; select release_lock('test_bug16407'); # Try to avoid # Bug#39863 events_bugs fails sporadically on pushbuild (extra processes in I_S.PROCESSLIST) @@ -162,23 +264,27 @@ select release_lock('test_bug16407'); # Bug#32782 User lock hash fails to find lock # "various issues related to missing or incorrect return results # from release_lock()." -# Therefore we check here if the event executing session disappeared or +# Therefore we check here if the event executor is no more locked or # we waited >= 5 seconds for this to happen. let $wait_timeout= 5; let $wait_condition= select count(*) = 0 from information_schema.processlist - where info = 'select get_lock(\'test_bug16407\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)'; --source include/wait_condition.inc if (!`$wait_condition`) { - --echo ERROR: There must be no session with info = 'select get_lock('test_bug16407', 60) within the processlist. + --echo ERROR: There must be no session with + --echo state = 'User lock' and info = 'select get_lock('test_bug16407', 60) + --echo within the processlist. --echo We probably hit Bug#32782 User lock hash fails to find lock - eval select * from information_schema.processlist; + SELECT * FROM information_schema.processlist; --echo Abort exit; } set global event_scheduler= off; +# Wait till the event scheduler and all event executors have finished their work. +--source include/check_events_off.inc select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; --echo "Let's check whether we change the sql_mode on ALTER EVENT" @@ -191,9 +297,10 @@ set sql_mode="ansi"; select get_lock('ee_16407_2', 60); set global event_scheduler= 1; +--source include/running_event_scheduler.inc --echo "Another sql_mode test" set sql_mode="traditional"; -create table events_smode_test(ev_name char(10), a date) engine=myisam; +create table events_smode_test(ev_name char(10), a date); --echo "This should never insert something" delimiter |; create event ee_16407_2 on schedule every 60 second do @@ -203,7 +310,7 @@ begin insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); end| --error ER_TRUNCATED_WRONG_VALUE -insert into events_smode_test values ('test','1980-19-02')| +insert into events_test.events_smode_test values ('test','1980-19-02')| --echo "This is ok" create event ee_16407_3 on schedule every 60 second do begin @@ -223,13 +330,20 @@ end| delimiter ;| select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; +# We wait till we have three event executors waiting for the removal of the lock. let $wait_condition= select count(*) = 3 from information_schema.processlist - where info = 'select get_lock(\'ee_16407_2\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; --source include/wait_condition.inc +# There is an extreme low risk that an additional event execution is just coming +# up because +# - the events have to be started every 60 seconds. +# - we are just after event creation + waiting for seeing 3 locked +# We expect to see three event executors in state 'User lock'. select /*2*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'ee_16407_2\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; + select release_lock('ee_16407_2'); # Try to avoid @@ -244,13 +358,37 @@ let $wait_timeout= 5; let $wait_condition= select count(*) = 0 from information_schema.processlist - where info = 'select get_lock(\'ee_16407_2\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; --source include/wait_condition.inc +if (!`$wait_condition`) +{ + --echo ERROR: There must be no session with + --echo state = 'User lock' and info = 'select get_lock('test_bug16407_2', 60) + --echo within the processlist. + --echo We probably hit Bug#32782 User lock hash fails to find lock + SELECT * FROM information_schema.processlist; + --echo Abort + exit; +} +# We expect to see no event executors in state 'User lock'. +if(!$fixed_bug41925) +{ + --disable_warnings +} select /*3*/ user, host, db, info from information_schema.processlist -where info = 'select get_lock(\'ee_16407_2\', 60)'; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; +if(!$fixed_bug41925) +{ + --enable_warnings +} + set global event_scheduler= off; -select * from events_smode_test order by ev_name, a; +# Wait till the event scheduler and all event executors have finished their work. +# Without this the next queries will give unstable results. +--source include/check_events_off.inc + +select * from events_test.events_smode_test order by ev_name, a; --echo "OK, last check before we drop them" select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; drop event ee_16407_2; @@ -259,11 +397,12 @@ drop event ee_16407_4; --echo "And now one last test regarding sql_mode and call of SP from an event" -delete from events_smode_test; +delete from events_test.events_smode_test; set sql_mode='ansi'; select get_lock('ee_16407_5', 60); set global event_scheduler= on; +--source include/running_event_scheduler.inc set sql_mode='traditional'; delimiter |; @@ -286,34 +425,46 @@ delimiter ;| let $wait_condition= select count(*) = 2 from information_schema.processlist - where info = 'select get_lock(\'ee_16407_5\', 60)'; + where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; --source include/wait_condition.inc --echo "Should have 2 locked processes" select /*4*/ user, host, db, info from information_schema.processlist -where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') -order by info; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; + select release_lock('ee_16407_5'); let $wait_condition= - select count(*) = 1 and user = 'event_scheduler' and info is null - from information_schema.processlist - where (command!='Daemon' || user='event_scheduler') - and (info is null or info not like '%processlist%'); + select count(*) = 0 from information_schema.processlist + where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; --source include/wait_condition.inc --echo "Should have 0 processes locked" +if(!$fixed_bug41925) +{ + --disable_warnings +} select /*5*/ user, host, db, info from information_schema.processlist -where (command!='Daemon' || user='event_scheduler') and (info is null or info not like '%processlist%') -order by info; -select * from events_smode_test order by ev_name, a; +where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)'; +if(!$fixed_bug41925) +{ + --enable_warnings +} + +# Wait till all event executors have finished their work, so that we can be sure +# that their changes to events_smode_test are done. +--source include/no_running_events.inc + +select * from events_test.events_smode_test order by ev_name, a; --echo "And here we check one more time before we drop the events" select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; + drop event ee_16407_5; drop event ee_16407_6; drop procedure ee_16407_5_pendant; drop procedure ee_16407_6_pendant; set global event_scheduler= off; +--source include/check_events_off.inc drop table events_smode_test; set sql_mode=@old_sql_mode; # @@ -324,6 +475,7 @@ set sql_mode=@old_sql_mode; # START - 18897: Events: unauthorized action possible with alter event rename # set global event_scheduler=off; +--source include/check_events_off.inc --disable_warnings delete from mysql.user where User like 'mysqltest_%'; delete from mysql.db where User like 'mysqltest_%'; @@ -409,6 +561,7 @@ create function f22830 () returns int return 5; select get_lock('ee_22830', 60); set global event_scheduler=on; +--source include/running_event_scheduler.inc delimiter |; create procedure p22830_wait() @@ -456,6 +609,7 @@ let $wait_condition= --source include/wait_condition.inc set global event_scheduler=off; +--source include/check_events_off.inc select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; drop procedure p22830_wait; drop function f22830; @@ -537,6 +691,7 @@ DROP USER mysqltest_u1@localhost; # For the actual tests of time zones please see events_time_zone.test # SET GLOBAL EVENT_SCHEDULER= OFF; +--source include/check_events_off.inc SET @save_time_zone= @@TIME_ZONE; #---------------------------------------------------------------------- @@ -749,6 +904,7 @@ let $engine=MyISAM; USE test; SHOW GRANTS FOR CURRENT_USER; SET GLOBAL event_scheduler = ON; +--source include/running_event_scheduler.inc eval CREATE TABLE events_test.event_log (id int KEY AUTO_INCREMENT, ev_nm char(40), ev_cnt int, ev_tm timestamp) @@ -817,12 +973,14 @@ disconnect e1; DROP EVENT events_test.ev_sched_1823; DROP TABLE events_test.event_log; SET GLOBAL event_scheduler = OFF; +--source include/check_events_off.inc # # Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash. # SET GLOBAL event_scheduler= ON; +--source include/running_event_scheduler.inc DELIMITER |; CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00' DO BEGIN @@ -831,6 +989,7 @@ END;| DELIMITER ;| SET GLOBAL event_scheduler= OFF; +--source include/check_events_off.inc DROP EVENT bug28641; ########################################################################### @@ -955,6 +1114,7 @@ SET GLOBAL READ_ONLY = 1; --echo SET GLOBAL EVENT_SCHEDULER = ON; +--source include/running_event_scheduler.inc --echo @@ -980,6 +1140,7 @@ let $wait_condition = --echo SET GLOBAL EVENT_SCHEDULER = OFF; +--source include/check_events_off.inc --echo @@ -1056,14 +1217,15 @@ drop event e1; # ########################################################################### -let $wait_condition= - select count(*) = 0 from information_schema.processlist - where db='events_test' and command = 'Connect' and user=current_user(); ---source include/wait_condition.inc +# Ensure that all event executors have finished their work and cannot harm +# the next test. +--source include/no_running_events.inc DROP DATABASE events_test; # Restore the original state (option with no argument in events_bugs-master.opt # turns the scheduler on). SET GLOBAL event_scheduler = 'ON'; +--source include/running_event_scheduler.inc +SET @@global.concurrent_insert = @concurrent_insert; # THIS MUST BE THE LAST LINE in this file. -- cgit v1.2.1 From 529fff05bf172dd806c2a6ccbdcf3222a0b35ab7 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Jan 2009 20:30:55 +0200 Subject: fixed a compile warning --- client/mysqltest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index d73cf78d9d4..62ec5a88599 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1344,7 +1344,7 @@ int diff_check() { char buf[512]= {0}; FILE *res_file; - char *cmd = "diff -v"; + const char *cmd = "diff -v"; int have_diff = 0; if (!(res_file= popen(cmd, "r"))) -- cgit v1.2.1 From 95e0d3bd061b086e94450b6a028c9d5b48a86376 Mon Sep 17 00:00:00 2001 From: "Tatiana A. Nurnberg" Date: Mon, 12 Jan 2009 06:32:49 +0100 Subject: Bug#31177: Server variables can't be set to their current values Bounds-checks and blocksize corrections were applied to user-input, but constants in the server were trusted implicitly. If these values did not actually meet the requirements, the user could not set change a variable, then set it back to the (wonky) factory default or maximum by explicitly specifying it (SET = vs SET =DEFAULT). Now checks also apply to the server's presets. Wonky values and maxima get corrected at startup. Consequently all non-offsetted values the user sees are valid, and users can set the variable to that exact value if they so desire. mysql-test/r/read_buffer_size_basic.result: test sets out of bounds value; we now throw a warning for this. This is a side-effect: before, the maximum was higher than the value we set here. The value was corrected to block-size, the maximum was not, hence the value was smaller than the maximum in this particular case. Now that we align the maxima at startup, the value in SET is larger than the (corrected) maximum, and we see a warning in this particular case. "This means we're doing it right." mysql-test/r/read_rnd_buffer_size_basic.result: test sets out of bounds value; we now throw a warning for this. This is a side-effect: before, the maximum was higher than the value we set here. The value was corrected to block-size, the maximum was not, hence the value was smaller than the maximum in this particular case. Now that we align the maxima at startup, the value in SET is larger than the (corrected) maximum, and we see a warning in this particular case. "This means we're doing it right." mysys/my_getopt.c: Do bounds-checking at start-up time so we'll catch and correct wonky default values and upper limits. sql/mysqld.cc: If 0 is a legal value per the docs, not to mention the default, we shouldn't give 1 as the lower limit. storage/innobase/handler/ha_innodb.cc: We are setting upper bounds here. ~0L gives -1. That is NOT what we want! --- mysql-test/r/read_buffer_size_basic.result | 4 ++++ mysql-test/r/read_rnd_buffer_size_basic.result | 4 ++++ mysys/my_getopt.c | 14 ++++++++------ sql/mysqld.cc | 2 +- storage/innobase/handler/ha_innodb.cc | 6 +++--- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/read_buffer_size_basic.result b/mysql-test/r/read_buffer_size_basic.result index 799f7b56235..3c007dc1515 100644 --- a/mysql-test/r/read_buffer_size_basic.result +++ b/mysql-test/r/read_buffer_size_basic.result @@ -86,6 +86,8 @@ SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 1 SET @@global.read_buffer_size = 2147479553; +Warnings: +Warning 1292 Truncated incorrect read_buffer_size value: '2147479553' SELECT @@global.read_buffer_size; @@global.read_buffer_size 2147479552 @@ -114,6 +116,8 @@ SELECT @@session.read_buffer_size= 8200 OR @@session.read_buffer_size= 8228 ; SET @@session.read_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 SET @@session.read_buffer_size = 2147479553; +Warnings: +Warning 1292 Truncated incorrect read_buffer_size value: '2147479553' SELECT @@session.read_buffer_size; @@session.read_buffer_size 2147479552 diff --git a/mysql-test/r/read_rnd_buffer_size_basic.result b/mysql-test/r/read_rnd_buffer_size_basic.result index c51b0591054..c6440ac032e 100644 --- a/mysql-test/r/read_rnd_buffer_size_basic.result +++ b/mysql-test/r/read_rnd_buffer_size_basic.result @@ -88,6 +88,8 @@ SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 822 @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228 1 SET @@global.read_rnd_buffer_size = 2147479553; +Warnings: +Warning 1292 Truncated incorrect read_rnd_buffer_size value: '2147479553' SELECT @@global.read_rnd_buffer_size; @@global.read_rnd_buffer_size 2147479552 @@ -116,6 +118,8 @@ SELECT @@session.read_rnd_buffer_size= 8200 OR @@session.read_rnd_buffer_size= 8 SET @@session.read_rnd_buffer_size = 65530.34.; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 SET @@session.read_rnd_buffer_size = 2147479553; +Warnings: +Warning 1292 Truncated incorrect read_rnd_buffer_size value: '2147479553' SELECT @@session.read_rnd_buffer_size; @@session.read_rnd_buffer_size 2147479552 diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 0f8055860d4..f97550d4429 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -976,24 +976,26 @@ static void init_one_value(const struct my_option *option, uchar* *variable, *((my_bool*) variable)= (my_bool) value; break; case GET_INT: - *((int*) variable)= (int) value; + *((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL); break; - case GET_UINT: case GET_ENUM: *((uint*) variable)= (uint) value; break; + case GET_UINT: + *((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL); + break; case GET_LONG: - *((long*) variable)= (long) value; + *((long*) variable)= (long) getopt_ll_limit_value((long) value, option, NULL); break; case GET_ULONG: - *((ulong*) variable)= (ulong) value; + *((ulong*) variable)= (ulong) getopt_ull_limit_value((ulong) value, option, NULL); break; case GET_LL: - *((longlong*) variable)= (longlong) value; + *((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL); break; case GET_ULL: case GET_SET: - *((ulonglong*) variable)= (ulonglong) value; + *((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL); break; case GET_DOUBLE: *((double*) variable)= (double) value; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1e9d942b1dd..a2ccbc42e77 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6611,7 +6611,7 @@ The minimum value for this variable is 4096.", {"max_user_connections", OPT_MAX_USER_CONNECTIONS, "The maximum number of active connections for a single user (0 = no limit).", (uchar**) &max_user_connections, (uchar**) &max_user_connections, 0, GET_UINT, - REQUIRED_ARG, 0, 1, UINT_MAX, 0, 1, 0}, + REQUIRED_ARG, 0, 0, UINT_MAX, 0, 1, 0}, {"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT, "After this many write locks, allow some read locks to run in between.", (uchar**) &max_write_lock_count, (uchar**) &max_write_lock_count, 0, GET_ULONG, diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index bf777b982db..6358f7ce055 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -8249,7 +8249,7 @@ static MYSQL_SYSVAR_BOOL(adaptive_hash_index, innobase_adaptive_hash_index, static MYSQL_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.", - NULL, NULL, 1*1024*1024L, 512*1024L, ~0L, 1024); + NULL, NULL, 1*1024*1024L, 512*1024L, LONG_MAX, 1024); static MYSQL_SYSVAR_ULONG(autoextend_increment, srv_auto_extend_increment, PLUGIN_VAR_RQCMDARG, @@ -8289,7 +8289,7 @@ static MYSQL_SYSVAR_LONG(lock_wait_timeout, innobase_lock_wait_timeout, static MYSQL_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "The size of the buffer which InnoDB uses to write log to the log files on disk.", - NULL, NULL, 1024*1024L, 256*1024L, ~0L, 1024); + NULL, NULL, 1024*1024L, 256*1024L, LONG_MAX, 1024); static MYSQL_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, @@ -8309,7 +8309,7 @@ static MYSQL_SYSVAR_LONG(mirrored_log_groups, innobase_mirrored_log_groups, static MYSQL_SYSVAR_LONG(open_files, innobase_open_files, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "How many files at the maximum InnoDB keeps open at the same time.", - NULL, NULL, 300L, 10L, ~0L, 0); + NULL, NULL, 300L, 10L, LONG_MAX, 0); static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds, PLUGIN_VAR_RQCMDARG, -- cgit v1.2.1 From d1323f433d21e49717b3a91fe79ae64f359a9093 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Mon, 12 Jan 2009 10:48:33 -0200 Subject: Post-merge fix for bug 37016: Update test case for row-based logging. mysql-test/r/commit_1innodb.result: Increase commit count for row-based logging. --- mysql-test/include/commit.inc | 2 +- mysql-test/r/commit_1innodb.result | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index de5eca8b1f6..beae927764f 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -733,7 +733,7 @@ call p_verify_status_increment(1, 0, 1, 0); rename table t4 to t3; call p_verify_status_increment(1, 0, 1, 0); truncate table t3; -call p_verify_status_increment(4, 4, 2, 2); +call p_verify_status_increment(4, 4, 4, 4); create view v1 as select * from t2; call p_verify_status_increment(1, 0, 1, 0); check table t1; diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result index 72e6b01bb03..eddd31c9374 100644 --- a/mysql-test/r/commit_1innodb.result +++ b/mysql-test/r/commit_1innodb.result @@ -853,7 +853,7 @@ call p_verify_status_increment(1, 0, 1, 0); SUCCESS truncate table t3; -call p_verify_status_increment(4, 4, 2, 2); +call p_verify_status_increment(4, 4, 4, 4); SUCCESS create view v1 as select * from t2; -- cgit v1.2.1 From 0b689ca3c977a4ac0bea5b63dd9ed011a0fc920f Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 12 Jan 2009 16:46:19 +0100 Subject: Backport of a 5.0.74 fix into 5.0.72sp1: Remove bashisms from BUILD/compile-dist and configure.in, so Bootstrap works on Solaris box; - force GNU make in compile-dist; - remove unportable "grep -q" from configure.in Original changeset: revision-id: build@mysql.com-20081203041148-icwscut3bk09ds47 parent: kgeorge@mysql.com-20081202125040-eiu6s7bk6s96s4xh author: timothy.smith@sun.com committer: MySQL Build Team branch nick: mysql-5.0.74-release timestamp: Wed 2008-12-03 05:11:48 +0100 --- BUILD/compile-dist | 36 ++++++++++++++++++++++++++++-------- configure.in | 28 ++++++++++++++++------------ 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/BUILD/compile-dist b/BUILD/compile-dist index 613f2643c56..7c2dbe00dc5 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -15,30 +15,49 @@ autoconf (cd bdb/dist && sh s_all) (cd innobase && aclocal && autoheader && aclocal && automake && autoconf) +gmake= +for x in gmake gnumake make; do + if $x --version 2>/dev/null | grep GNU > /dev/null; then + gmake=$x + break; + fi +done + +if [ -z "$gmake" ]; then + # Our build may not depend on GNU make, but I wouldn't count on it + echo "Please install GNU make, and ensure it is in your path as gnumake, gmake, or make" >&2 + exit 2 +fi + # Default to gcc for CC and CXX if test -z "$CXX" ; then - export CXX=gcc + export CXX + CXX=gcc # Set some required compile options if test -z "$CXXFLAGS" ; then - export CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" + export CXXFLAGS + CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" fi fi if test -z "$CC" ; then - export CC=gcc + export CC + CC=gcc fi # Use ccache, if available if ccache -V > /dev/null 2>&1 then - if ! (echo "$CC" | grep "ccache" > /dev/null) + if echo "$CC" | grep -v ccache > /dev/null then - export CC="ccache $CC" + export CC + CC="ccache $CC" fi - if ! (echo "$CXX" | grep "ccache" > /dev/null) + if echo "$CXX" | grep -v ccache > /dev/null then - export CXX="ccache $CXX" + export CXX + CXX="ccache $CXX" fi fi @@ -50,4 +69,5 @@ fi --enable-thread-safe-client \ --with-extra-charsets=complex \ --with-ndbcluster -make + +$gmake diff --git a/configure.in b/configure.in index f48f1544677..162e21d9d75 100644 --- a/configure.in +++ b/configure.in @@ -409,7 +409,7 @@ fi MYSQL_PROG_AR # libmysqlclient versioning when linked with GNU ld. -if $LD --version 2>/dev/null|grep -q GNU; then +if $LD --version 2>/dev/null|grep GNU > /dev/null; then LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver" AC_CONFIG_FILES(libmysql/libmysql.ver) fi @@ -437,11 +437,13 @@ dnl Find paths to some shell programs AC_PATH_PROG(LN, ln, ln) # This must be able to take a -f flag like normal unix ln. AC_PATH_PROG(LN_CP_F, ln, ln) -if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then -# If ln -f does not exists use -s (AFS systems) -if test -n "$LN_CP_F"; then - LN_CP_F="$LN_CP_F -s" -fi +if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then + : +else + # If ln -f does not exists use -s (AFS systems) + if test -n "$LN_CP_F"; then + LN_CP_F="$LN_CP_F -s" + fi fi AC_PATH_PROG(MV, mv, mv) @@ -1940,14 +1942,16 @@ MYSQL_CHECK_IN_ADDR_T # Do the c++ compiler have a bool type MYSQL_CXX_BOOL # Check some common bugs with gcc 2.8.# on sparc -if ! ( expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null ); then -MYSQL_CHECK_LONGLONG_TO_FLOAT -if test "$ac_cv_conv_longlong_to_float" != "yes" -then - AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! +if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then + : +else + MYSQL_CHECK_LONGLONG_TO_FLOAT + if test "$ac_cv_conv_longlong_to_float" != "yes" + then + AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try again]) -fi + fi fi AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include ]) AC_CHECK_TYPES([size_t], [], [], [#include ]) -- cgit v1.2.1 From 16f374ef65270940e181d9136b5886510365c8d1 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 12 Jan 2009 17:09:03 +0100 Subject: Backport of a 5.0.74 fix into 5.0.72sp1: Bug #40021: Renaming view fails, archived .frm for view is missing after downgrade Original changeset: > revision-id: gshchepa@mysql.com-20081114172557-xh0jlzwal8ze3cy6 > parent: ramil@mysql.com-20081114074229-vj4fvfrpmz8jfub9 > committer: Gleb Shchepa > branch nick: mysql-5.0-bugteam > timestamp: Fri 2008-11-14 21:25:57 +0400 --- sql/parse_file.cc | 93 +++--------------------------------------------------- sql/parse_file.h | 6 ++-- sql/sql_db.cc | 2 -- sql/sql_trigger.cc | 8 ++--- sql/sql_view.cc | 33 ++++--------------- sql/table.h | 1 - 6 files changed, 17 insertions(+), 126 deletions(-) diff --git a/sql/parse_file.cc b/sql/parse_file.cc index 2b947fcac4f..ade0709cf0d 100644 --- a/sql/parse_file.cc +++ b/sql/parse_file.cc @@ -88,7 +88,6 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s) file pointer to IO_CACHE structure for writing base pointer to data structure parameter pointer to parameter descriptor - old_version for returning back old version number value RETURN FALSE - OK @@ -96,8 +95,7 @@ write_escaped_string(IO_CACHE *file, LEX_STRING *val_s) */ static my_bool -write_parameter(IO_CACHE *file, gptr base, File_option *parameter, - ulonglong *old_version) +write_parameter(IO_CACHE *file, gptr base, File_option *parameter) { char num_buf[20]; // buffer for numeric operations // string for numeric operations @@ -125,15 +123,6 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, DBUG_RETURN(TRUE); break; } - case FILE_OPTIONS_REV: - { - ulonglong *val_i= (ulonglong *)(base + parameter->offset); - *old_version= (*val_i)++; - num.set(*val_i, &my_charset_bin); - if (my_b_append(file, (const byte *)num.ptr(), num.length())) - DBUG_RETURN(TRUE); - break; - } case FILE_OPTIONS_TIMESTAMP: { /* string have to be allocated already */ @@ -205,7 +194,6 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, base base address for parameter reading (structure like TABLE) parameters parameters description - max_versions number of versions to save RETURN FALSE - OK @@ -215,13 +203,11 @@ write_parameter(IO_CACHE *file, gptr base, File_option *parameter, my_bool sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, const LEX_STRING *type, - gptr base, File_option *parameters, - uint max_versions) + gptr base, File_option *parameters) { File handler; IO_CACHE file; char path[FN_REFLEN+1]; // +1 to put temporary file name for sure - ulonglong old_version= ULONGLONG_MAX; int path_end; File_option *param; DBUG_ENTER("sql_create_definition_file"); @@ -255,7 +241,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, if (my_b_append(&file, (const byte *)param->name.str, param->name.length) || my_b_append(&file, (const byte *)STRING_WITH_LEN("=")) || - write_parameter(&file, base, param, &old_version) || + write_parameter(&file, base, param) || my_b_append(&file, (const byte *)STRING_WITH_LEN("\n"))) goto err_w_cache; } @@ -269,55 +255,6 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, } path[path_end]='\0'; -#ifdef FRM_ARCHIVE - // archive copies management: disabled unused feature (see bug #17823). - if (!access(path, F_OK)) - { - if (old_version != ULONGLONG_MAX && max_versions != 0) - { - // save backup - char path_arc[FN_REFLEN]; - // backup old version - char path_to[FN_REFLEN]; - - // check archive directory existence - fn_format(path_arc, "arc", dir->str, "", MY_UNPACK_FILENAME); - if (access(path_arc, F_OK)) - { - if (my_mkdir(path_arc, 0777, MYF(MY_WME))) - { - DBUG_RETURN(TRUE); - } - } - - my_snprintf(path_to, FN_REFLEN, "%s/%s-%04lu", - path_arc, file_name->str, (ulong) old_version); - if (my_rename(path, path_to, MYF(MY_WME))) - { - DBUG_RETURN(TRUE); - } - - // remove very old version - if (old_version > max_versions) - { - my_snprintf(path_to, FN_REFLEN, "%s/%s-%04lu", - path_arc, file_name->str, - (ulong)(old_version - max_versions)); - if (!access(path_arc, F_OK) && my_delete(path_to, MYF(MY_WME))) - { - DBUG_RETURN(TRUE); - } - } - } - else - { - if (my_delete(path, MYF(MY_WME))) // no backups - { - DBUG_RETURN(TRUE); - } - } - } -#endif//FRM_ARCHIVE { // rename temporary file @@ -346,8 +283,6 @@ err_w_file: schema name of given schema old_name original file name new_name new file name - revision revision number - num_view_backups number of backups RETURN 0 - OK @@ -356,8 +291,7 @@ err_w_file: */ my_bool rename_in_schema_file(THD *thd, const char *schema, const char *old_name, - const char *new_name, ulonglong revision, - uint num_view_backups) + const char *new_name) { char old_path[FN_REFLEN], new_path[FN_REFLEN], arc_path[FN_REFLEN]; @@ -376,23 +310,6 @@ my_bool rename_in_schema_file(THD *thd, strxnmov(arc_path, FN_REFLEN, mysql_data_home, "/", schema, "/arc", NullS); (void) unpack_filename(arc_path, arc_path); -#ifdef FRM_ARCHIVE - if (revision > 0 && !access(arc_path, F_OK)) - { - ulonglong limit= ((revision > num_view_backups) ? - revision - num_view_backups : 0); - for (; revision > limit ; revision--) - { - my_snprintf(old_path, FN_REFLEN, "%s/%s%s-%04lu", - arc_path, old_name, reg_ext, (ulong)revision); - (void) unpack_filename(old_path, old_path); - my_snprintf(new_path, FN_REFLEN, "%s/%s%s-%04lu", - arc_path, new_name, reg_ext, (ulong)revision); - (void) unpack_filename(new_path, new_path); - my_rename(old_path, new_path, MYF(0)); - } - } -#else//FRM_ARCHIVE { // remove obsolete 'arc' directory and files if any MY_DIR *new_dirp; if ((new_dirp = my_dir(arc_path, MYF(MY_DONT_SORT)))) @@ -401,7 +318,6 @@ my_bool rename_in_schema_file(THD *thd, (void) mysql_rm_arc_files(thd, new_dirp, arc_path); } } -#endif//FRM_ARCHIVE return 0; } @@ -838,7 +754,6 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root, break; } case FILE_OPTIONS_ULONGLONG: - case FILE_OPTIONS_REV: if (!(eol= strchr(ptr, '\n'))) { my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0), diff --git a/sql/parse_file.h b/sql/parse_file.h index ec920b58667..ad7d1629e0a 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -23,7 +23,6 @@ enum file_opt_type { FILE_OPTIONS_STRING, /* String (LEX_STRING) */ FILE_OPTIONS_ESTRING, /* Escaped string (LEX_STRING) */ FILE_OPTIONS_ULONGLONG, /* ulonglong parameter (ulonglong) */ - FILE_OPTIONS_REV, /* Revision version number (ulonglong) */ FILE_OPTIONS_TIMESTAMP, /* timestamp (LEX_STRING have to be allocated with length 20 (19+1) */ FILE_OPTIONS_STRLIST, /* list of escaped strings @@ -81,11 +80,10 @@ File_parser *sql_parse_prepare(const LEX_STRING *file_name, my_bool sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name, const LEX_STRING *type, - gptr base, File_option *parameters, uint versions); + gptr base, File_option *parameters); my_bool rename_in_schema_file(THD *thd, const char *schema, const char *old_name, - const char *new_name, ulonglong revision, - uint num_view_backups); + const char *new_name); class File_parser: public Sql_alloc { diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 8fbb407555a..c3cf7429222 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -909,7 +909,6 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, /* .frm archive: Those archives are obsolete, but following code should exist to remove existent "arc" directories. - See #ifdef FRM_ARCHIVE directives for obsolete code. */ char newpath[FN_REFLEN]; MY_DIR *new_dirp; @@ -1069,7 +1068,6 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error) NOTE A support of "arc" directories is obsolete, however this function should exist to remove existent "arc" directories. - See #ifdef FRM_ARCHIVE directives for obsolete code. */ long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path) { diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index bead50e1da8..d3b5289cd68 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -479,7 +479,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, trigname.trigger_table.length= tables->table_name_length; if (sql_create_definition_file(&dir, &trigname_file, &trigname_file_type, - (gptr)&trigname, trigname_file_parameters, 0)) + (gptr)&trigname, trigname_file_parameters)) return 1; /* @@ -569,7 +569,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, /* Create trigger definition file. */ if (!sql_create_definition_file(&dir, &file, &triggers_file_type, - (gptr)this, triggers_file_parameters, 0)) + (gptr)this, triggers_file_parameters)) return 0; err_with_cleanup: @@ -656,7 +656,7 @@ static bool save_trigger_file(Table_triggers_list *triggers, const char *db, file.str= file_buff; return sql_create_definition_file(&dir, &file, &triggers_file_type, - (gptr)triggers, triggers_file_parameters, 0); + (gptr)triggers, triggers_file_parameters); } @@ -1427,7 +1427,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name, trigname.trigger_table= *new_table_name; if (sql_create_definition_file(&dir, &trigname_file, &trigname_file_type, - (gptr)&trigname, trigname_file_parameters, 0)) + (gptr)&trigname, trigname_file_parameters)) return trigger; } diff --git a/sql/sql_view.cc b/sql/sql_view.cc index dffad0cc575..91991ce77bb 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -660,7 +660,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, } VOID(pthread_mutex_unlock(&LOCK_open)); - if (view->revision != 1) + if (mode != VIEW_CREATE_NEW) query_cache_invalidate3(thd, view, 0); start_waiting_global_read_lock(thd); if (res) @@ -678,12 +678,8 @@ err: } -/* index of revision number in following table */ -static const int revision_number_position= 8; -/* index of last required parameter for making view */ -static const int required_view_parameters= 10; -/* number of backups */ -static const int num_view_backups= 3; +/* number of required parameters for making view */ +static const int required_view_parameters= 9; /* table of VIEW .frm field descriptors @@ -716,9 +712,6 @@ static File_option view_parameters[]= {{(char*) STRING_WITH_LEN("with_check_option")}, my_offsetof(TABLE_LIST, with_check), FILE_OPTIONS_ULONGLONG}, - {{(char*) STRING_WITH_LEN("revision")}, - my_offsetof(TABLE_LIST, revision), - FILE_OPTIONS_REV}, {{(char*) STRING_WITH_LEN("timestamp")}, my_offsetof(TABLE_LIST, timestamp), FILE_OPTIONS_TIMESTAMP}, @@ -870,18 +863,9 @@ loop_out: } /* - read revision number - TODO: read dependence list, too, to process cascade/restrict TODO: special cascade/restrict procedure for alter? */ - if (parser->parse((gptr)view, thd->mem_root, - view_parameters + revision_number_position, 1, - &file_parser_dummy_hook)) - { - error= thd->net.report_error? -1 : 0; - goto err; - } } else { @@ -923,7 +907,7 @@ loop_out: } if (sql_create_definition_file(&dir, &file, view_file_type, - (gptr)view, view_parameters, num_view_backups)) + (gptr)view, view_parameters)) { error= thd->net.report_error? -1 : 1; goto err; @@ -1858,8 +1842,7 @@ mysql_rename_view(THD *thd, goto err; /* rename view and it's backups */ - if (rename_in_schema_file(thd, view->db, view->table_name, new_name, - view_def.revision - 1, num_view_backups)) + if (rename_in_schema_file(thd, view->db, view->table_name, new_name)) goto err; strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", view->db, "/", NullS); @@ -1873,12 +1856,10 @@ mysql_rename_view(THD *thd, - file_buff); if (sql_create_definition_file(&pathstr, &file, view_file_type, - (gptr)&view_def, view_parameters, - num_view_backups)) + (gptr)&view_def, view_parameters)) { /* restore renamed view in case of error */ - rename_in_schema_file(thd, view->db, new_name, view->table_name, - view_def.revision - 1, num_view_backups); + rename_in_schema_file(thd, view->db, new_name, view->table_name); goto err; } } else diff --git a/sql/table.h b/sql/table.h index 08326e2fbe0..0884f5ba3d2 100644 --- a/sql/table.h +++ b/sql/table.h @@ -657,7 +657,6 @@ struct TABLE_LIST st_lex_user definer; /* definer of view */ ulonglong file_version; /* version of file's field set */ ulonglong updatable_view; /* VIEW can be updated */ - ulonglong revision; /* revision control number */ ulonglong algorithm; /* 0 any, 1 tmp tables , 2 merging */ ulonglong view_suid; /* view is suid (TRUE dy default) */ ulonglong with_check; /* WITH CHECK OPTION */ -- cgit v1.2.1 From b91bbba2dfd49eb364f16cfdf5b13b6c75a7a43a Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 12 Jan 2009 18:17:15 +0200 Subject: Fixed a warning in sql_profile.cc --- sql/sql_profile.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index c62cf6401ba..cb5b3722559 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -552,8 +552,8 @@ int PROFILING::fill_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond) The order of these fields is set by the query_profile_statistics_info array. */ - table->field[0]->store((ulonglong) query->profiling_query_id); - table->field[1]->store((ulonglong) seq); /* the step in the sequence */ + table->field[0]->store((ulonglong) query->profiling_query_id, TRUE); + table->field[1]->store((ulonglong) seq, TRUE); /* the step in the sequence */ /* This entry, n, has a point in time, T(n), and a status phrase, S(n). The status phrase S(n) describes the period of time that begins at -- cgit v1.2.1 From 3b23a99b8759349a07ed065f4044c3fa4b05e328 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 12 Jan 2009 17:18:53 +0100 Subject: Backport of a 5.0.74 fix into 5.0.72sp1: BUG#38842 - Fix for 25951 seems incorrect Original changeset: > revision-id: svoj@mysql.com-20081111091051-54pr96nf1z2s30gx > parent: vvaintroub@mysql.com-20081110201804-bi98gcs9avsf58ff > committer: Sergey Vojtovich > branch nick: mysql-5.0-bugteam-bug38842 > timestamp: Tue 2008-11-11 13:10:51 +0400 --- mysql-test/r/fulltext.result | 28 ++++++++++++++++++++++++++++ mysql-test/t/fulltext.test | 27 +++++++++++++++++++++++++++ sql/item_func.cc | 4 +++- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 29fb430bb97..e73f8af405c 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -469,3 +469,31 @@ SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE); a aaaaa aaaa DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b)); +INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1), +('test', 1),('test', 2),('test', 3),('test', 4); +EXPLAIN SELECT * FROM t1 +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext b,a a 0 1 Using where +EXPLAIN SELECT * FROM t1 USE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +EXPLAIN SELECT * FROM t1 FORCE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +EXPLAIN SELECT * FROM t1 IGNORE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref b b 5 const 4 Using where +EXPLAIN SELECT * FROM t1 USE INDEX(b) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref b b 5 const 4 Using where +EXPLAIN SELECT * FROM t1 FORCE INDEX(b) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref b b 5 const 4 Using where +DROP TABLE t1; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index e5f1db14b7f..fa087d89efb 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -396,3 +396,30 @@ SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE); DROP TABLE t1; # End of 4.1 tests + +# +# BUG#38842 - Fix for 25951 seems incorrect +# +CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b)); +INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1), + ('test', 1),('test', 2),('test', 3),('test', 4); + +EXPLAIN SELECT * FROM t1 +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; + +EXPLAIN SELECT * FROM t1 USE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; + +EXPLAIN SELECT * FROM t1 FORCE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; + +EXPLAIN SELECT * FROM t1 IGNORE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; + +EXPLAIN SELECT * FROM t1 USE INDEX(b) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; + +EXPLAIN SELECT * FROM t1 FORCE INDEX(b) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; + +DROP TABLE t1; diff --git a/sql/item_func.cc b/sql/item_func.cc index e663e1fcf83..66fbf1eb4d2 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5022,7 +5022,9 @@ bool Item_func_match::fix_index() for (keynr=0 ; keynr < table->s->keys ; keynr++) { if ((table->key_info[keynr].flags & HA_FULLTEXT) && - (table->s->keys_in_use.is_set(keynr))) + (flags & FT_BOOL ? table->keys_in_use_for_query.is_set(keynr) : + table->s->keys_in_use.is_set(keynr))) + { ft_to_key[fts]=keynr; ft_cnt[fts]=0; -- cgit v1.2.1 From 3055db5c0e4e753866bb50d792f0ad4f18e12643 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 12 Jan 2009 17:24:00 +0100 Subject: Backport of a 5.0.74 fix into 5.0.72sp1: Bug#34760 Character set autodetection appears to fail the problem is the same as reported in bug#20835, so the fix is backport of bug#20835 patch. Original changeset: > revision-id: sergey.glukhov@sun.com-20081121123959-58ffhp2nitg7f40h > parent: ramil@mysql.com-20081120100836-gct60cm67b1rui29 > committer: Sergey Glukhov > branch nick: mysql-5.0-bugteam > timestamp: Fri 2008-11-21 16:39:59 +0400 --- mysql-test/r/subselect.result | 15 +++++++++++++++ mysql-test/t/subselect.test | 19 ++++++++++++++++++- sql/item_cmpfunc.cc | 3 ++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index c5bae840214..6eeb652e3c1 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4407,4 +4407,19 @@ pk a 3 30 2 20 DROP TABLE t1,t2; +CREATE TABLE t1 (s1 char(1)); +INSERT INTO t1 VALUES ('a'); +SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1); +s1 +a +DROP TABLE t1; +CREATE TABLE t1(id BIGINT); +CREATE TABLE t2(id1 BIGINT, id2 BIGINT); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t2 VALUES (2,1),(3,1); +SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1); +id +2 +3 +DROP TABLE t1, t2; End of 5.0 tests. diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 2dfad2c58dd..d28e31fb545 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3307,5 +3307,22 @@ SELECT * FROM t1 WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b); DROP TABLE t1,t2; ---echo End of 5.0 tests. +# +# Bug#20835 (literal string with =any values) +# +CREATE TABLE t1 (s1 char(1)); +INSERT INTO t1 VALUES ('a'); +SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1); +DROP TABLE t1; +# +# Bug#40519 Subselect query using bigint fails +# +CREATE TABLE t1(id BIGINT); +CREATE TABLE t2(id1 BIGINT, id2 BIGINT); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t2 VALUES (2,1),(3,1); +SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1); +DROP TABLE t1, t2; + +--echo End of 5.0 tests. diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0410c781590..4bfae376acc 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1434,7 +1434,8 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref) } not_null_tables_cache= args[0]->not_null_tables(); with_sum_func= args[0]->with_sum_func; - const_item_cache= args[0]->const_item(); + if ((const_item_cache= args[0]->const_item())) + cache->store(args[0]); return 0; } -- cgit v1.2.1 From 75d276ad61a63c8734e959758670256ccac1eac0 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 12 Jan 2009 17:40:29 +0100 Subject: Backport of a 5.0.74 fix into 5.0.72sp1: Bug #39920: MySQL cannot deal with Leap Second expression in string literal. Updated MySQL time handling code to react correctly on UTC leap second additions. MySQL functions that return the OS current time, like e.g. CURDATE(), NOW() etc will return :59:59 instead of :59:60 or 59:61. As a result the reader will receive :59:59 for 2 or 3 consecutive seconds during the leap second. Original changesets: > revision-id: kgeorge@mysql.com-20081201141835-rg8nnnadujj5wl9f > parent: gshchepa@mysql.com-20081114172557-xh0jlzwal8ze3cy6 > committer: Georgi Kodinov > branch nick: B39920-5.0-bugteam > timestamp: Mon 2008-12-01 16:18:35 +0200 > revision-id: kgeorge@mysql.com-20081201154106-c310zzy5or043rqa > parent: kgeorge@mysql.com-20081201145656-6kjq91oga5nxbbob > committer: Georgi Kodinov > branch nick: B39920-merge-5.0-bugteam > timestamp: Mon 2008-12-01 17:41:06 +0200 --- mysql-test/r/timezone2.result | 2 +- mysql-test/r/timezone3.result | 8 ++++++++ mysql-test/std_data/Moscow_leap | Bin 991 -> 2674 bytes mysql-test/t/timezone3.test | 12 ++++++++++++ sql/tztime.cc | 22 ++++++++++++++++++++++ sql/tztime.h | 3 +++ 6 files changed, 46 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result index bb1d764ac8c..e115ce16fa4 100644 --- a/mysql-test/r/timezone2.result +++ b/mysql-test/r/timezone2.result @@ -110,7 +110,7 @@ i ts 362793610 1981-07-01 04:00:00 select from_unixtime(362793609); from_unixtime(362793609) -1981-07-01 03:59:60 +1981-07-01 03:59:59 drop table t1; create table t1 (ts timestamp); set time_zone='UTC'; diff --git a/mysql-test/r/timezone3.result b/mysql-test/r/timezone3.result index ec0b6045f93..ceac4a5aefb 100644 --- a/mysql-test/r/timezone3.result +++ b/mysql-test/r/timezone3.result @@ -17,6 +17,9 @@ insert into t1 values insert into t1 values (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'), (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00'); +insert into t1 values +(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'), +(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00'); select i, from_unixtime(i), c from t1; i from_unixtime(i) c 1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00 @@ -31,6 +34,8 @@ i from_unixtime(i) c 1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59 362793608 1981-07-01 03:59:59 1981-07-01 03:59:59 362793610 1981-07-01 04:00:00 1981-07-01 04:00:00 +1230768022 2009-01-01 02:59:59 2009-01-01 02:59:59 +1230768024 2009-01-01 03:00:00 2009-01-01 03:00:00 drop table t1; create table t1 (ts timestamp); insert into t1 values (19730101235900), (20040101235900); @@ -39,3 +44,6 @@ ts 1973-01-01 23:59:00 2004-01-01 23:59:00 drop table t1; +SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024); +FROM_UNIXTIME(1230768022) FROM_UNIXTIME(1230768023) FROM_UNIXTIME(1230768024) +2009-01-01 02:59:59 2009-01-01 02:59:59 2009-01-01 03:00:00 diff --git a/mysql-test/std_data/Moscow_leap b/mysql-test/std_data/Moscow_leap index 4994c005595..3e73923cfb3 100644 Binary files a/mysql-test/std_data/Moscow_leap and b/mysql-test/std_data/Moscow_leap differ diff --git a/mysql-test/t/timezone3.test b/mysql-test/t/timezone3.test index 0aedbafcec4..8a9941f6383 100644 --- a/mysql-test/t/timezone3.test +++ b/mysql-test/t/timezone3.test @@ -45,6 +45,10 @@ insert into t1 values (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'), (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00'); +insert into t1 values + (unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'), + (unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00'); + select i, from_unixtime(i), c from t1; drop table t1; @@ -58,4 +62,12 @@ insert into t1 values (19730101235900), (20040101235900); select * from t1; drop table t1; +# +# Test Bug #39920: MySQL cannot deal with Leap Second expression in string +# literal +# + +# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00 +SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024); + # End of 4.1 tests diff --git a/sql/tztime.cc b/sql/tztime.cc index 709e3b64752..d3d952e3c1e 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1073,6 +1073,7 @@ Time_zone_system::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const localtime_r(&tmp_t, &tmp_tm); localtime_to_TIME(tmp, &tmp_tm); tmp->time_type= MYSQL_TIMESTAMP_DATETIME; + adjust_leap_second(tmp); } @@ -1157,6 +1158,7 @@ Time_zone_utc::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const gmtime_r(&tmp_t, &tmp_tm); localtime_to_TIME(tmp, &tmp_tm); tmp->time_type= MYSQL_TIMESTAMP_DATETIME; + adjust_leap_second(tmp); } @@ -1260,6 +1262,7 @@ void Time_zone_db::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const { ::gmt_sec_to_TIME(tmp, t, tz_info); + adjust_leap_second(tmp); } @@ -2373,6 +2376,25 @@ Time_zone *my_tz_find_with_opening_tz_tables(THD *thd, const String *name) DBUG_RETURN(tz); } + +/** + Convert leap seconds into non-leap + + This function will convert the leap seconds added by the OS to + non-leap seconds, e.g. 23:59:59, 23:59:60 -> 23:59:59, 00:00:01 ... + This check is not checking for years on purpose : although it's not a + complete check this way it doesn't require looking (and having installed) + the leap seconds table. + + @param[in,out] broken down time structure as filled in by the OS +*/ + +void Time_zone::adjust_leap_second(MYSQL_TIME *t) +{ + if (t->second == 60 || t->second == 61) + t->second= 59; +} + #endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */ diff --git a/sql/tztime.h b/sql/tztime.h index 32a942a26e1..750b8dacbe1 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -55,6 +55,9 @@ public: allocated on MEM_ROOT and should not require destruction. */ virtual ~Time_zone() {}; + +protected: + static inline void adjust_leap_second(MYSQL_TIME *t); }; extern Time_zone * my_tz_UTC; -- cgit v1.2.1 From f4d0b4760ac5ea78c20c8f88321576b1456683d9 Mon Sep 17 00:00:00 2001 From: Chad MILLER Date: Mon, 12 Jan 2009 14:48:02 -0500 Subject: Bug#38364: gen_lex_hash segmentation fault in debug build Bug#36428: MY_MUTEX_INIT_FAST is used before initialization On some thread implementations, we need a fake mutex attri- bute as a placeholder, which we define as a global variable, "my_fast_mutexattr". Well. that must be initialized before used in any mutexes, and the ordering of initializations in the API function my_init() was wrong. Now, put my_thread_global_init(), which initializes the attri- butes that mutexes require. --- mysys/my_init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mysys/my_init.c b/mysys/my_init.c index 4b45d5ddc1a..0eec242818d 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -78,8 +78,12 @@ my_bool my_init(void) my_umask= 0660; /* Default umask for new files */ my_umask_dir= 0700; /* Default umask for new directories */ init_glob_errs(); -#if defined(THREAD) && defined(SAFE_MUTEX) +#if defined(THREAD) + if (my_thread_global_init()) + return 1; +# if defined(SAFE_MUTEX) safe_mutex_global_init(); /* Must be called early */ +# endif #endif #if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) fastmutex_global_init(); /* Must be called early */ @@ -89,8 +93,6 @@ my_bool my_init(void) #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif - if (my_thread_global_init()) - return 1; #if !defined( __WIN__) && !defined(__NETWARE__) sigfillset(&my_signals); /* signals blocked by mf_brkhant */ #endif -- cgit v1.2.1 From 4baf24267e50724dd08a1e8e52e1d2cd8805075c Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Mon, 12 Jan 2009 22:02:40 +0100 Subject: Set the version: 5.0.72sp1 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 162e21d9d75..2f36c6c0816 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.72) +AM_INIT_AUTOMAKE(mysql, 5.0.72sp1) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 -- cgit v1.2.1 From fed5e9773386b38990181ef671418228025aad60 Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Mon, 12 Jan 2009 18:45:35 -0500 Subject: Bug#41888: Test binlog.binlog_database causing binlog_innodb to fail on Pushbuild. Added cleanup of status variables to the end of binlog_database. Re-recorded .result file to account for cleanup statement. NOTE: binlog.binlog_innodb also has had an FLUSH STATUS; statement added to it as well, but adding this cleanup as a preventative measure. --- mysql-test/extra/binlog_tests/database.test | 2 ++ mysql-test/suite/binlog/r/binlog_database.result | 3 +++ 2 files changed, 5 insertions(+) diff --git a/mysql-test/extra/binlog_tests/database.test b/mysql-test/extra/binlog_tests/database.test index 2e445f98adf..326ecedb60e 100644 --- a/mysql-test/extra/binlog_tests/database.test +++ b/mysql-test/extra/binlog_tests/database.test @@ -28,3 +28,5 @@ enable_warnings; insert into t1 values (1); drop table tt1, t1; source include/show_binlog_events.inc; + +FLUSH STATUS; diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result index 3b470fe11af..39b889d8d0a 100644 --- a/mysql-test/suite/binlog/r/binlog_database.result +++ b/mysql-test/suite/binlog/r/binlog_database.result @@ -33,6 +33,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # drop database if exists mysqltest1 master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # use `test`; drop table tt1, t1 +FLUSH STATUS; set binlog_format=mixed; reset master; create database testing_1; @@ -68,6 +69,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # drop database if exists mysqltest1 master-bin.000001 # Query # # use `test`; insert into t1 values (1) master-bin.000001 # Query # # use `test`; drop table tt1, t1 +FLUSH STATUS; set binlog_format=row; reset master; create database testing_1; @@ -108,6 +110,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +FLUSH STATUS; show databases; Database information_schema -- cgit v1.2.1 From 4dcd3c81d7f8321c2272094d859813b4d9a71005 Mon Sep 17 00:00:00 2001 From: Matthias Leich Date: Tue, 13 Jan 2009 14:09:24 +0100 Subject: Fix for Bug#40377 sporadic pushbuild failure in log_state: result mismatch + add workaround for bug 38124 + messages into the protocol when sessions are switched + replace error numbers by error names + reset of system variables to initial values per subtest + remove a file created by this test + minor improvements in structure and formatting --- mysql-test/r/log_state.result | 81 ++++++++++------- mysql-test/t/log_state.test | 200 +++++++++++++++++++++++++++++++----------- 2 files changed, 195 insertions(+), 86 deletions(-) diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index 63903a034d2..5c3e3d789a1 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -1,3 +1,7 @@ +SET @old_general_log= @@global.general_log; +SET @old_general_log_file= @@global.general_log_file; +SET @old_slow_query_log= @@global.slow_query_log; +SET @old_slow_query_log_file= @@global.slow_query_log_file; set global general_log= OFF; truncate table mysql.general_log; truncate table mysql.slow_log; @@ -33,20 +37,26 @@ general_log ON log ON log_slow_queries OFF slow_query_log OFF -set session long_query_time=1; -select sleep(2); -sleep(2) +# Establish connection con1 (user=root) +# Switch to connection con1 +set @long_query_time = ; +set session long_query_time = @long_query_time; +select sleep(@long_query_time + 1); +sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text +# Switch to connection default set global slow_query_log= ON; -set session long_query_time=1; -select sleep(2); -sleep(2) +# Switch to connection con1 +set session long_query_time = @long_query_time; +select sleep(@long_query_time + 1); +sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text -TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(2) +TIMESTAMP USER_HOST QUERY_TIME 00:00:00 1 0 test 0 0 1 select sleep(@long_query_time + 1) +# Switch to connection default show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or Variable_name = 'general_log' or Variable_name = 'slow_query_log'; @@ -92,8 +102,8 @@ slow_query_log_file # show variables like 'log_output'; Variable_name Value log_output FILE,TABLE -set global general_log_file='/not exiting path/log.master'; -ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master' +set global general_log_file='/not existing path/log.master'; +ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not existing path/log.master' set global general_log_file='MYSQLTEST_VARDIR'; ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR' set global general_log_file=''; @@ -153,8 +163,10 @@ select * from mysql.general_log; event_time user_host thread_id server_id command_type argument TIMESTAMP USER_HOST # 1 Query drop table t1 TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log -SET @old_general_log_state = @@global.general_log; -SET @old_slow_log_state = @@global.slow_query_log; +SET @@global.general_log = @old_general_log; +SET @@global.general_log_file = @old_general_log_file; +SET @@global.slow_query_log = @old_slow_query_log; +SET @@global.slow_query_log_file = @old_slow_query_log_file; SET GLOBAL general_log = ON; SET GLOBAL slow_query_log = ON; FLUSH TABLES WITH READ LOCK; @@ -173,10 +185,9 @@ SET GLOBAL READ_ONLY = ON; SET GLOBAL general_log = ON; SET GLOBAL slow_query_log = ON; SET GLOBAL READ_ONLY = OFF; -SET GLOBAL general_log = @old_general_log_state; -SET GLOBAL slow_query_log = @old_slow_log_state; -SET @old_general_log_state = @@global.general_log; -SET @old_slow_log_state = @@global.slow_query_log; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; +SET GLOBAL general_log = ON; SHOW VARIABLES LIKE 'general_log'; Variable_name Value general_log ON @@ -239,29 +250,24 @@ log_slow_queries ON SELECT @@slow_query_log, @@log_slow_queries; @@slow_query_log @@log_slow_queries 1 1 -SET GLOBAL general_log = @old_general_log_state; -SET GLOBAL slow_query_log = @old_slow_log_state; -set @old_general_log_file= @@global.general_log_file; -set @old_slow_query_log_file= @@global.slow_query_log_file; -set global general_log_file= concat('/not exiting path/log.maste', 'r'); -ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master' -set global general_log_file= NULL; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; +SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r'); +ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not existing path/log.master' +SET GLOBAL general_log_file= NULL; ERROR 42000: Variable 'general_log_file' can't be set to the value of 'NULL' -set global slow_query_log_file= concat('/not exiting path/log.maste', 'r'); -ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not exiting path/log.master' -set global slow_query_log_file= NULL; +SET GLOBAL slow_query_log_file= CONCAT('/not existing path/log.maste', 'r'); +ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not existing path/log.master' +SET GLOBAL slow_query_log_file= NULL; ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'NULL' -set global general_log_file= @old_general_log_file; -set global slow_query_log_file= @old_slow_query_log_file; +SET GLOBAL general_log_file= @old_general_log_file; +SET GLOBAL slow_query_log_file= @old_slow_query_log_file; # -- # -- Bug#32748: Inconsistent handling of assignments to -# -- general_log_file/slow_query_log_file. +# -- general_log_file/slow_query_log_file. # -- -SET @general_log_file_saved = @@global.general_log_file; -SET @slow_query_log_file_saved = @@global.slow_query_log_file; - SET GLOBAL general_log_file = 'bug32748.query.log'; SET GLOBAL slow_query_log_file = 'bug32748.slow.log'; @@ -270,8 +276,8 @@ Variable_name Value general_log_file bug32748.query.log slow_query_log_file bug32748.slow.log -SET GLOBAL general_log_file = @general_log_file_saved; -SET GLOBAL slow_query_log_file = @slow_query_log_file_saved; +SET GLOBAL general_log_file = @old_general_log_file; +SET GLOBAL slow_query_log_file = @old_slow_query_log_file; # -- End of Bug#32748. deprecated: @@ -298,4 +304,13 @@ SET GLOBAL general_log_file = @my_glf; SET GLOBAL slow_query_log_file = @my_sqlf; SET GLOBAL general_log = DEFAULT; SET GLOBAL slow_query_log = DEFAULT; +SET @@global.general_log = @old_general_log; +SET @@global.general_log_file = @old_general_log_file; +SET @@global.slow_query_log = @old_slow_query_log; +SET @@global.slow_query_log_file = @old_slow_query_log_file; End of 5.1 tests +# Close connection con1 +SET global general_log = @old_general_log; +SET global general_log_file = @old_general_log_file; +SET global slow_query_log = @old_slow_query_log; +SET global slow_query_log_file = @old_slow_query_log_file; diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test index 977b74aa1e3..e8ff60a8637 100644 --- a/mysql-test/t/log_state.test +++ b/mysql-test/t/log_state.test @@ -1,6 +1,28 @@ --- source include/not_embedded.inc +### t/log_state.test ### +# +# This test suffers from server +# Bug#38124 "general_log_file" variable silently unset when using expression +# In short: +# SET GLOBAL general_log_file = @ +# SET GLOBAL slow_query_log = @ +# cause that the value of these server system variables is set to default +# instead of the assigned values. There comes no error message or warning. +# If this bug is fixed please +# 1. try this test with "let $fixed_bug38124 = 0;" +# 2. remove all workarounds if 1. was successful. +let $fixed_bug38124 = 0; + +--source include/not_embedded.inc --source include/have_csv.inc +# Several subtests modify global variables. Save the initial values only here, +# but reset to the initial values per subtest. +SET @old_general_log= @@global.general_log; +SET @old_general_log_file= @@global.general_log_file; +SET @old_slow_query_log= @@global.slow_query_log; +SET @old_slow_query_log_file= @@global.slow_query_log_file; + + --disable_ps_protocol set global general_log= OFF; truncate table mysql.general_log; @@ -23,20 +45,32 @@ show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or Variable_name = 'general_log' or Variable_name = 'slow_query_log'; +--echo # Establish connection con1 (user=root) connect (con1,localhost,root,,); +--echo # Switch to connection con1 connection con1; -set session long_query_time=1; -select sleep(2); +# Please increase @long_query_time if the corresponding selects show an +# additional unexpected entry like +# start_time ... sql_text +# TIMESTAMP ... set session long_query_time=... +# (Bug#40377 sporadic pushbuild failure in log_state: result mismatch) +--replace_result 2 +set @long_query_time = 2; +set session long_query_time = @long_query_time; +select sleep(@long_query_time + 1); --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; +--echo # Switch to connection default connection default; set global slow_query_log= ON; +--echo # Switch to connection con1 connection con1; -set session long_query_time=1; -select sleep(2); +set session long_query_time = @long_query_time; +select sleep(@long_query_time + 1); --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; +--echo # Switch to connection default connection default; show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or @@ -71,16 +105,16 @@ show variables like 'slow_query_log_file'; show variables like 'log_output'; # Can't set general_log_file to a non existing file ---error 1231 -set global general_log_file='/not exiting path/log.master'; +--error ER_WRONG_VALUE_FOR_VAR +set global general_log_file='/not existing path/log.master'; # Can't set general_log_file to a directory --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---error 1231 +--error ER_WRONG_VALUE_FOR_VAR eval set global general_log_file='$MYSQLTEST_VARDIR'; # Can't set general_log_file to empty string ---error 1231 +--error ER_WRONG_VALUE_FOR_VAR set global general_log_file=''; --replace_column 2 # @@ -126,17 +160,30 @@ drop table t1; --replace_column 1 TIMESTAMP 2 USER_HOST 3 # select * from mysql.general_log; -# -# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes -# a deadlock) +# Reset to initial values +SET @@global.general_log = @old_general_log; +SET @@global.general_log_file = @old_general_log_file; +SET @@global.slow_query_log = @old_slow_query_log; +SET @@global.slow_query_log_file = @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} -# save state -SET @old_general_log_state = @@global.general_log; -SET @old_slow_log_state = @@global.slow_query_log; +########################################################################### -# Test ON->OFF transition under a GLOBAL READ LOCK +# +# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes +# a deadlock) +# +# Test ON->OFF transition under a GLOBAL READ LOCK SET GLOBAL general_log = ON; SET GLOBAL slow_query_log = ON; @@ -148,7 +195,6 @@ SET GLOBAL slow_query_log = OFF; UNLOCK TABLES; # Test OFF->ON transition under a GLOBAL READ LOCK - FLUSH TABLES WITH READ LOCK; SET GLOBAL general_log = ON; @@ -157,7 +203,6 @@ SET GLOBAL slow_query_log = ON; UNLOCK TABLES; # Test ON->OFF transition under a GLOBAL READ_ONLY - SET GLOBAL READ_ONLY = ON; SET GLOBAL general_log = OFF; @@ -166,7 +211,6 @@ SET GLOBAL slow_query_log = OFF; SET GLOBAL READ_ONLY = OFF; # Test OFF->ON transition under a GLOBAL READ_ONLY - SET GLOBAL READ_ONLY = ON; SET GLOBAL general_log = ON; @@ -174,17 +218,18 @@ SET GLOBAL slow_query_log = ON; SET GLOBAL READ_ONLY = OFF; -# Restore state +# Reset to initial values +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; + -SET GLOBAL general_log = @old_general_log_state; -SET GLOBAL slow_query_log = @old_slow_log_state; +########################################################################### # -# Bug #29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it +# Bug#29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it # -SET @old_general_log_state = @@global.general_log; -SET @old_slow_log_state = @@global.slow_query_log; +SET GLOBAL general_log = ON; SHOW VARIABLES LIKE 'general_log'; SHOW VARIABLES LIKE 'log'; @@ -210,39 +255,47 @@ SHOW VARIABLES LIKE 'slow_query_log'; SHOW VARIABLES LIKE 'log_slow_queries'; SELECT @@slow_query_log, @@log_slow_queries; -SET GLOBAL general_log = @old_general_log_state; -SET GLOBAL slow_query_log = @old_slow_log_state; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; + + +########################################################################### # -# Bug #31604: server crash when setting slow_query_log_file/general_log_file +# Bug#31604: server crash when setting slow_query_log_file/general_log_file # -set @old_general_log_file= @@global.general_log_file; -set @old_slow_query_log_file= @@global.slow_query_log_file; ---error 1231 -set global general_log_file= concat('/not exiting path/log.maste', 'r'); ---error 1231 -set global general_log_file= NULL; ---error 1231 -set global slow_query_log_file= concat('/not exiting path/log.maste', 'r'); ---error 1231 -set global slow_query_log_file= NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r'); +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL general_log_file= NULL; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL slow_query_log_file= CONCAT('/not existing path/log.maste', 'r'); +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL slow_query_log_file= NULL; + +# Reset to initial values in case a setting above was successful. +SET GLOBAL general_log_file= @old_general_log_file; +SET GLOBAL slow_query_log_file= @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} -set global general_log_file= @old_general_log_file; -set global slow_query_log_file= @old_slow_query_log_file; ########################################################################### --echo --echo # -- --echo # -- Bug#32748: Inconsistent handling of assignments to ---echo # -- general_log_file/slow_query_log_file. +--echo # -- general_log_file/slow_query_log_file. --echo # -- ---echo -SET @general_log_file_saved = @@global.general_log_file; -SET @slow_query_log_file_saved = @@global.slow_query_log_file; - --echo SET GLOBAL general_log_file = 'bug32748.query.log'; SET GLOBAL slow_query_log_file = 'bug32748.slow.log'; @@ -250,27 +303,37 @@ SET GLOBAL slow_query_log_file = 'bug32748.slow.log'; --echo SHOW VARIABLES LIKE '%log_file'; +# Reset to initial values --echo -SET GLOBAL general_log_file = @general_log_file_saved; -SET GLOBAL slow_query_log_file = @slow_query_log_file_saved; +SET GLOBAL general_log_file = @old_general_log_file; +SET GLOBAL slow_query_log_file = @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} --echo --echo # -- End of Bug#32748. -########################################################################### - +########################################################################### -## WL#4403 - deprecate @log and @slow_log_queries variables +# WL#4403 - deprecate @log and @slow_log_queries variables -## these are all deprecated -- show for command-line as well! +# These server system variables are all deprecated +# -- show for command-line as well! --echo deprecated: SET GLOBAL log = 0; SET GLOBAL log_slow_queries = 0; SET GLOBAL log = DEFAULT; SET GLOBAL log_slow_queries = DEFAULT; -## these are NOT deprecated +# These server system variables are NOT deprecated. --echo not deprecated: SELECT @@global.general_log_file INTO @my_glf; SELECT @@global.slow_query_log_file INTO @my_sqlf; @@ -283,6 +346,20 @@ SET GLOBAL slow_query_log_file = @my_sqlf; SET GLOBAL general_log = DEFAULT; SET GLOBAL slow_query_log = DEFAULT; +## Reset to initial values +SET @@global.general_log = @old_general_log; +SET @@global.general_log_file = @old_general_log_file; +SET @@global.slow_query_log = @old_slow_query_log; +SET @@global.slow_query_log_file = @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} --echo End of 5.1 tests @@ -290,10 +367,27 @@ SET GLOBAL slow_query_log = DEFAULT; --enable_ps_protocol # -# Cleanup (must be done last to avoid delayed 'Quit' message in general log) +# Cleanup # +# Disconnect must be done last to avoid delayed 'Quit' message in general log +--echo # Close connection con1 disconnect con1; +# Reset global system variables to initial values if forgotten somewhere above. +SET global general_log = @old_general_log; +SET global general_log_file = @old_general_log_file; +SET global slow_query_log = @old_slow_query_log; +SET global slow_query_log_file = @old_slow_query_log_file; +if(!$fixed_bug38124) +{ + --disable_query_log + let $my_var = `SELECT @old_general_log_file`; + eval SET @@global.general_log_file = '$my_var'; + let $my_var = `SELECT @old_slow_query_log_file`; + eval SET @@global.slow_query_log_file = '$my_var'; + --enable_query_log +} # Remove the log files that was created in the "default location" # i.e var/run --remove_file $MYSQLTEST_VARDIR/run/master.log +--remove_file $MYSQLTEST_VARDIR/tmp/log.master -- cgit v1.2.1 From 1fc458230d18abd6145dec3ae89aefbd1f5e892a Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Tue, 13 Jan 2009 14:52:22 +0100 Subject: Tool fix, needed for "compile-dist" to succeed on Solaris: The default "awk" there cannot handle some of the scripts which are used by BDB for configuration. The fix: 1) Introduce a variable "AWK" in some of the BDB shell scripts, 2) search "gawk" and give it precedence over "awk" when assigning a value to the "AWK" variable, fail if neither is found, 3) use that variable when calling an "awk" program with one of the critical scripts. The perfect solution would be to use the "awk" program found by "configure", but we cannot follow that approach because BDB's configuration is handled as a special case before the overall "configure" is run. Because of this, 1) the "configure" result isn't yet available, 2) "configure" will not handle these BDB files. Searching "gawk" is a (not-so-nice) way out. Note that all this need not be perfectly portable, it is needed only when we create a source distribution tarball from a develkopment tree. bdb/dist/s_all: Search "gawk" if available, give it precedence over "awk", fail if neither is found. bdb/dist/s_include: Ensure we use a modern AWK, similar to GNU awk, the default awk on Solaris cannot handle BDB's script. bdb/dist/s_recover: Ensure we use a modern AWK, similar to GNU awk, the default awk on Solaris cannot handle BDB's script. bdb/dist/s_rpc: Ensure we use a modern AWK, similar to GNU awk, the default awk on Solaris cannot handle BDB's script. --- bdb/dist/s_all | 15 +++++++++++++++ bdb/dist/s_include | 6 +++--- bdb/dist/s_recover | 2 +- bdb/dist/s_rpc | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/bdb/dist/s_all b/bdb/dist/s_all index 132017def3c..97ce572a4ae 100644 --- a/bdb/dist/s_all +++ b/bdb/dist/s_all @@ -1,6 +1,21 @@ #!/bin/sh - # $Id: s_all,v 1.10 2001/08/04 14:01:44 bostic Exp $ +# Search an AWK program, use GNU awk if available +for x in gawk awk ; do + if type $x; then + AWK=$x + break + fi +done + +if test -z "$AWK"; then + echo 'No AWK program found' + exit 1 +fi +export AWK +# end of AWK search + sh s_dir #sh s_perm # permissions. diff --git a/bdb/dist/s_include b/bdb/dist/s_include index 878b4a38af1..5cb3a666dc0 100755 --- a/bdb/dist/s_include +++ b/bdb/dist/s_include @@ -79,7 +79,7 @@ for i in db btree clib common dbreg env fileops hash hmac \ [ $i = os ] && f="$f ../os_win32/*.c" [ $i = rpc_server ] && f="../$i/c/*.c" [ $i = crypto ] && f="../$i/*.c ../$i/*/*.c" - awk -f gen_inc.awk \ + $AWK -f gen_inc.awk \ -v db_version_unique_name=$DB_VERSION_UNIQUE_NAME \ -v e_dfile=$e_dfile \ -v e_pfile=$e_pfile \ @@ -97,7 +97,7 @@ done # files. for i in dbm hsearch; do f="../$i/*.c" - awk -f gen_inc.awk \ + $AWK -f gen_inc.awk \ -v db_version_unique_name=$DB_VERSION_UNIQUE_NAME \ -v e_dfile=$e_dfile \ -v e_pfile=$e_pfile \ @@ -142,7 +142,7 @@ head space defonly _DB_EXT_185_DEF_IN_ > $e_dfile head space _DB_EXT_185_PROT_IN_ > $e_pfile f="../db185/*.c" -awk -f gen_inc.awk \ +$AWK -f gen_inc.awk \ -v db_version_unique_name=$DB_VERSION_UNIQUE_NAME \ -v e_dfile=$e_dfile \ -v e_pfile=$e_pfile \ diff --git a/bdb/dist/s_recover b/bdb/dist/s_recover index fc2e160c083..f6d2ad33e5a 100755 --- a/bdb/dist/s_recover +++ b/bdb/dist/s_recover @@ -45,7 +45,7 @@ cmp $loglist $f > /dev/null 2>&1 || for i in db dbreg btree fileops hash qam txn; do for f in ../$i/*.src; do subsystem=`basename $f .src` - awk -f gen_rec.awk \ + $AWK -f gen_rec.awk \ -v source_file=$source \ -v header_file=$header \ -v template_file=$template < $f diff --git a/bdb/dist/s_rpc b/bdb/dist/s_rpc index cdafa669d85..f9495ec121f 100644 --- a/bdb/dist/s_rpc +++ b/bdb/dist/s_rpc @@ -43,7 +43,7 @@ rm -f $client_file \ xidsize=\ `awk '/^#define/ { if ($2 == "DB_XIDDATASIZE") { print $3 }}' $dbinc_file` -awk -f gen_rpc.awk \ +$AWK -f gen_rpc.awk \ -v major=$DB_VERSION_MAJOR \ -v minor=$DB_VERSION_MINOR \ -v xidsize=$xidsize \ -- cgit v1.2.1 From 3bee9e6a8f6f72916c508385409b541d2f6d58c3 Mon Sep 17 00:00:00 2001 From: Matthias Leich Date: Tue, 13 Jan 2009 15:04:28 +0100 Subject: Merge of fix for bug 41776 type_date.test may fail if run around midnight. into GCA tree. --- mysql-test/r/type_date.result | 13 ++++++++----- mysql-test/t/type_date.test | 31 +++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 7cb71831bce..f96e07b0c5e 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -65,12 +65,15 @@ CREATE TABLE t1(AFIELD INT); INSERT INTO t1 VALUES(1); CREATE TABLE t2(GMT VARCHAR(32)); INSERT INTO t2 VALUES('GMT-0800'); -SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD; -DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) +FROM t1, t2 GROUP BY t1.AFIELD; +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) Wed, 06 March 2002 10:11:12 GMT-0800 INSERT INTO t1 VALUES(1); -SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD; -DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)), +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) +FROM t1,t2 GROUP BY t1.AFIELD; +DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800 drop table t1,t2; CREATE TABLE t1 (f1 time default NULL, f2 time default NULL); @@ -155,7 +158,7 @@ str_to_date( '', a ) 0000-00-00 00:00:00 NULL DROP TABLE t1; -CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b)); +CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b)); INSERT INTO t1 VALUES (DATE(NOW()), 1); SELECT COUNT(*) FROM t1 WHERE a = NOW(); COUNT(*) diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 9bc428c3715..aec60bc2dee 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -62,7 +62,7 @@ drop table t1; # Test of date and not null # -create table t1 (date date); +create table t1 (date date); insert into t1 values ("2000-08-10"),("2000-08-11"); select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1; drop table t1; @@ -75,9 +75,12 @@ CREATE TABLE t1(AFIELD INT); INSERT INTO t1 VALUES(1); CREATE TABLE t2(GMT VARCHAR(32)); INSERT INTO t2 VALUES('GMT-0800'); -SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD; +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) +FROM t1, t2 GROUP BY t1.AFIELD; INSERT INTO t1 VALUES(1); -SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD; +SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)), + DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)) +FROM t1,t2 GROUP BY t1.AFIELD; drop table t1,t2; # @@ -90,7 +93,7 @@ SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1; DROP TABLE t1; # -# Bug 4937: different date -> string conversion when using SELECT ... UNION +# Bug#4937: different date -> string conversion when using SELECT ... UNION # and INSERT ... SELECT ... UNION # @@ -141,7 +144,7 @@ select * from t1; drop table t1; # -# Bug #30942: select str_to_date from derived table returns varying results +# Bug#30942: select str_to_date from derived table returns varying results # CREATE TABLE t1 ( a INT @@ -155,10 +158,22 @@ DROP TABLE t1; # -# Bug #31221: Optimizer incorrectly identifies impossible WHERE clause +# Bug#31221: Optimizer incorrectly identifies impossible WHERE clause # -CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b)); +CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b)); +## The current sub test could fail (difference to expected result) if we +## have just reached midnight. +## (Bug#41776 type_date.test may fail if run around midnight) +## Therefore we sleep a bit if we are too close to midnight. +## The complete test itself needs in average less than 1 second. +## Therefore a time_distance to midnight of 5 seconds should be sufficient. +if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`) +{ + # We are here when CURTIME() is between '23:59:56' and '23:59:59'. + # So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'. + --real_sleep 5 +} INSERT INTO t1 VALUES (DATE(NOW()), 1); SELECT COUNT(*) FROM t1 WHERE a = NOW(); EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); @@ -174,7 +189,7 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); DROP TABLE t1; # -# Bug #28687: Search fails on '0000-00-00' date after sql_mode change +# Bug#28687: Search fails on '0000-00-00' date after sql_mode change # CREATE TABLE t1 (a DATE); -- cgit v1.2.1 From f2c122bf9080d9f0e2e61890edea697e76be5bf6 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Wed, 14 Jan 2009 16:27:32 +0800 Subject: BUG#41986 Replication slave does not pick up proper AUTO_INCREMENT value for Innodb tables The next number (AUTO_INCREMENT) field of the table for write rows events are not initialized, and cause some engines (innodb) not correctly update the tables's auto_increment value. This patch fixed this problem by honor next number fields if present. mysql-test/extra/rpl_tests/rpl_auto_increment.test: Add test code for BUG#41986 mysql-test/suite/rpl/r/rpl_auto_increment.result: update test result file for BUG#41986 sql/log_event.cc: set next_number_field before writing rows, and reset next_number_field after finished writing rows --- mysql-test/extra/rpl_tests/rpl_auto_increment.test | 17 +++++++++++++++++ mysql-test/suite/rpl/r/rpl_auto_increment.result | 17 +++++++++++++++++ sql/log_event.cc | 4 ++++ 3 files changed, 38 insertions(+) diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test index 1fa3cf034f6..24448a38408 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test @@ -145,6 +145,23 @@ select * from t3 order by a; connection master; drop table t1,t2,t3; +sync_slave_with_master; + +# +# BUG#41986 Replication slave does not pick up proper AUTO_INCREMENT value for Innodb tables +# +connection master; +set auto_increment_increment=1; +set auto_increment_offset=1; +CREATE TABLE t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +show create table t1; + +sync_slave_with_master; +show create table t1; + +connection master; +drop table t1; # End cleanup sync_slave_with_master; diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment.result b/mysql-test/suite/rpl/r/rpl_auto_increment.result index 083f3a4e901..2a4c3a09361 100644 --- a/mysql-test/suite/rpl/r/rpl_auto_increment.result +++ b/mysql-test/suite/rpl/r/rpl_auto_increment.result @@ -227,3 +227,20 @@ select * from t3 order by a; a 127 drop table t1,t2,t3; +set auto_increment_increment=1; +set auto_increment_offset=1; +CREATE TABLE t1 (id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=innodb; +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +drop table t1; diff --git a/sql/log_event.cc b/sql/log_event.cc index dfaf8e3c931..cf338d8fd80 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -8091,6 +8091,9 @@ Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability analyze if explicit data is provided for slave's TIMESTAMP columns). */ m_table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET; + + /* Honor next number column if present */ + m_table->next_number_field= m_table->found_next_number_field; return error; } @@ -8099,6 +8102,7 @@ Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability * int error) { int local_error= 0; + m_table->next_number_field=0; if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 || m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER) { -- cgit v1.2.1 From 53e42d9ee48ada71dc151dda0dd5119187cf5b5b Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Wed, 14 Jan 2009 18:50:51 +0400 Subject: Fix for bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers and #41385: Crash when attempting to repair a #mysql50# upgraded table with triggers. Problem: 1. trigger code didn't assume a table name may have a "#mysql50#" prefix, that may lead to a failing ASSERT(). 2. "ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME" failed for databases with "#mysql50#" prefix if any trigger. 3. mysqlcheck --fix-table-name didn't use UTF8 as a default character set that resulted in (parsing) errors for tables with non-latin symbols in their names and definitions of triggers. Fix: 1. properly handle table/database names with "#mysql50#" prefix. 2. handle --default-character-set mysqlcheck option; if mysqlcheck is launched with --fix-table-name or --fix-db-name set default character set to UTF8 if no --default-character-set option given. Note: if given --fix-table-name or --fix-db-name option, without --default-character-set mysqlcheck option default character set is UTF8. client/mysqlcheck.c: Fix for bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers and #41385: Crash when attempting to repair a #mysql50# upgraded table with triggers. - check and set default charset if --default-character-set option given. - set default charset to "utf8" if there's --fix-table-name or --fix-db-name and no --default-character-set. mysql-test/r/mysqlcheck.result: Fix for bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers and #41385: Crash when attempting to repair a #mysql50# upgraded table with triggers. - test result. mysql-test/t/mysqlcheck.test: Fix for bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers and #41385: Crash when attempting to repair a #mysql50# upgraded table with triggers. - test case. sql/mysql_priv.h: Fix for bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers and #41385: Crash when attempting to repair a #mysql50# upgraded table with triggers. - check_n_cut_mysql50_prefix() introduced. sql/sql_table.cc: Fix for bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers and #41385: Crash when attempting to repair a #mysql50# upgraded table with triggers. - tablename_to_filename() code split into 2 parts - check_n_cut_mysql50_prefix() introduced to cut #mysql50# prefixes, used in the trigger code as well. sql/sql_trigger.cc: Fix for bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers and #41385: Crash when attempting to repair a #mysql50# upgraded table with triggers. - Table_triggers_list::check_n_load() - checking triggers assume a table/database name given may have "#mysql50#" prefix in some cases. - Table_triggers_list::change_table_name_in_triggers() - create .TRG file in new database directory and delete it in old one, as they may differ in case of "ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME" - Table_triggers_list::change_table_name_in_trignames() - remove stale .TRN files in #mysql50#dbname directory in case of database upgrade - Table_triggers_list::change_table_name() - allow changing trigger's database in case of its upgrading sql/sql_trigger.h: Fix for bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers and #41385: Crash when attempting to repair a #mysql50# upgraded table with triggers. - new old_db_name parameter added in Table_triggers_list::change_table_name_in_trignames() and Table_triggers_list::change_table_name_in_triggers() --- client/mysqlcheck.c | 27 ++++++++----- mysql-test/r/mysqlcheck.result | 55 ++++++++++++++++++++++++++ mysql-test/t/mysqlcheck.test | 73 +++++++++++++++++++++++++++++++++++ sql/mysql_priv.h | 1 + sql/sql_table.cc | 31 ++++++++++++--- sql/sql_trigger.cc | 88 +++++++++++++++++++++++++++++++----------- sql/sql_trigger.h | 6 ++- 7 files changed, 241 insertions(+), 40 deletions(-) diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 17ebca497e4..86e1b3352b4 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -40,15 +40,13 @@ static uint verbose = 0, opt_mysql_port=0; static int my_end_arg; static char * opt_mysql_unix_port = 0; static char *opt_password = 0, *current_user = 0, - *default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME, - *current_host = 0; + *default_charset= 0, *current_host= 0; static int first_error = 0; DYNAMIC_ARRAY tables4repair; #ifdef HAVE_SMEM static char *shared_memory_base_name=0; #endif static uint opt_protocol=0; -static CHARSET_INFO *charset_info= &my_charset_latin1; enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE }; @@ -282,12 +280,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case OPT_FIX_DB_NAMES: what_to_do= DO_UPGRADE; - default_charset= (char*) "utf8"; opt_databases= 1; break; case OPT_FIX_TABLE_NAMES: what_to_do= DO_UPGRADE; - default_charset= (char*) "utf8"; break; case 'p': if (argument) @@ -367,11 +363,20 @@ static int get_options(int *argc, char ***argv) what_to_do = DO_CHECK; } - /* TODO: This variable is not yet used */ - if (strcmp(default_charset, charset_info->csname) && - !(charset_info= get_charset_by_csname(default_charset, - MY_CS_PRIMARY, MYF(MY_WME)))) - exit(1); + /* + If there's no --default-character-set option given with + --fix-table-name or --fix-db-name set the default character set to "utf8". + */ + if (!default_charset && (opt_fix_db_names || opt_fix_table_names)) + { + default_charset= (char*) "utf8"; + } + if (default_charset && !get_charset_by_csname(default_charset, MY_CS_PRIMARY, + MYF(MY_WME))) + { + printf("Unsupported character set: %s\n", default_charset); + return 1; + } if (*argc > 0 && opt_alldbs) { printf("You should give only options, no arguments at all, with option\n"); @@ -779,6 +784,8 @@ static int dbConnect(char *host, char *user, char *passwd) if (shared_memory_base_name) mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif + if (default_charset) + mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset); if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd, NULL, opt_mysql_port, opt_mysql_unix_port, 0))) { diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index e222d66c5b6..313cba51ec9 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -130,3 +130,58 @@ v1 v-1 drop view v1, `v-1`; drop table t1; +SET NAMES utf8; +CREATE TABLE `#mysql50#@` (a INT); +SHOW TABLES; +Tables_in_test +#mysql50#@ +SET NAMES DEFAULT; +mysqlcheck --fix-table-names --databases test +SET NAMES utf8; +SHOW TABLES; +Tables_in_test +@ +DROP TABLE `@`; +CREATE TABLE `я` (a INT); +SET NAMES DEFAULT; +mysqlcheck --default-character-set="latin1" --databases test +test.? +Error : Table 'test.?' doesn't exist +error : Corrupt +mysqlcheck --default-character-set="utf8" --databases test +test.я OK +SET NAMES utf8; +DROP TABLE `я`; +SET NAMES DEFAULT; +CREATE DATABASE `#mysql50#a@b`; +USE `#mysql50#a@b`; +CREATE TABLE `#mysql50#c@d` (a INT); +CREATE TABLE t1 (a INT); +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS +WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL #mysql50#a@b tr1 INSERT NULL #mysql50#a@b #mysql50#c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +NULL #mysql50#a@b tr2 INSERT NULL #mysql50#a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +Warnings: +Warning 1603 Triggers for table `#mysql50#a@b`.`#mysql50#c@d` have no creation context +Warning 1603 Triggers for table `#mysql50#a@b`.`t1` have no creation context +mysqlcheck --fix-db-names --fix-table-names --all-databases +USE `a@b`; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS +WHERE TRIGGER_SCHEMA="a@b" ORDER BY trigger_name; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL a@b tr1 INSERT NULL a@b c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci +NULL a@b tr2 INSERT NULL a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci +INSERT INTO `c@d` VALUES (2), (1); +SELECT * FROM `c@d`; +a +20 +10 +INSERT INTO t1 VALUES (3), (5); +SELECT * FROM t1; +a +300 +500 +DROP DATABASE `a@b`; +USE test; +End of 5.1 tests diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index 0e675731fd5..b085cc5866a 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -112,3 +112,76 @@ show tables; show tables; drop view v1, `v-1`; drop table t1; + +# +# Bug #33094: Error in upgrading from 5.0 to 5.1 when table contains triggers +# Bug #41385: Crash when attempting to repair a #mysql50# upgraded table with +# triggers +# +SET NAMES utf8; +CREATE TABLE `#mysql50#@` (a INT); +SHOW TABLES; +SET NAMES DEFAULT; +--echo mysqlcheck --fix-table-names --databases test +--exec $MYSQL_CHECK --fix-table-names --databases test +SET NAMES utf8; +SHOW TABLES; +DROP TABLE `@`; + +CREATE TABLE `я` (a INT); +SET NAMES DEFAULT; +--echo mysqlcheck --default-character-set="latin1" --databases test +--exec $MYSQL_CHECK --default-character-set="latin1" --databases test +--echo mysqlcheck --default-character-set="utf8" --databases test +--exec $MYSQL_CHECK --default-character-set="utf8" --databases test +SET NAMES utf8; +DROP TABLE `я`; +SET NAMES DEFAULT; + +CREATE DATABASE `#mysql50#a@b`; +USE `#mysql50#a@b`; +CREATE TABLE `#mysql50#c@d` (a INT); +CREATE TABLE t1 (a INT); + +# Create 5.0 like triggers +--write_file $MYSQLTEST_VARDIR/master-data/a@b/c@d.TRG +TYPE=TRIGGERS +triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON `c@d` FOR EACH ROW SET NEW.a = 10 * NEW.a' +sql_modes=0 +definers='root@localhost' +EOF +--write_file $MYSQLTEST_VARDIR/master-data/a@b/tr1.TRN +TYPE=TRIGGERNAME +trigger_table=c@d +EOF +--write_file $MYSQLTEST_VARDIR/master-data/a@b/t1.TRG +TYPE=TRIGGERS +triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 BEFORE INSERT ON `a@b`.t1 FOR EACH ROW SET NEW.a = 100 * NEW.a' +sql_modes=0 +definers='root@localhost' +EOF +--write_file $MYSQLTEST_VARDIR/master-data/a@b/tr2.TRN +TYPE=TRIGGERNAME +trigger_table=t1 +EOF + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS + WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name; + +--echo mysqlcheck --fix-db-names --fix-table-names --all-databases +--exec $MYSQL_CHECK --fix-db-names --fix-table-names --all-databases + +USE `a@b`; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS + WHERE TRIGGER_SCHEMA="a@b" ORDER BY trigger_name; + +INSERT INTO `c@d` VALUES (2), (1); +SELECT * FROM `c@d`; +INSERT INTO t1 VALUES (3), (5); +SELECT * FROM t1; + +DROP DATABASE `a@b`; + +USE test; + +--echo End of 5.1 tests diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index fb09ef810d9..c32ebc6d39d 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2230,6 +2230,7 @@ uint strconvert(CHARSET_INFO *from_cs, const char *from, CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors); uint filename_to_tablename(const char *from, char *to, uint to_length); uint tablename_to_filename(const char *from, char *to, uint to_length); +uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length); #endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */ #ifdef MYSQL_SERVER uint build_table_filename(char *buff, size_t bufflen, const char *db, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 224cf1123e2..3ec03be72a5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -114,6 +114,30 @@ uint filename_to_tablename(const char *from, char *to, uint to_length) } +/** + Check if given string begins with "#mysql50#" prefix, cut it if so. + + @param from string to check and cut + @param to[out] buffer for result string + @param to_length its size + + @retval + 0 no prefix found + @retval + non-0 result string length +*/ + +uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length) +{ + if (from[0] == '#' && + !strncmp(from, MYSQL50_TABLE_NAME_PREFIX, + MYSQL50_TABLE_NAME_PREFIX_LENGTH)) + return (uint) (strmake(to, from + MYSQL50_TABLE_NAME_PREFIX_LENGTH, + to_length - 1) - to); + return 0; +} + + /* Translate a table name to a file name (WL #1324). @@ -133,11 +157,8 @@ uint tablename_to_filename(const char *from, char *to, uint to_length) DBUG_ENTER("tablename_to_filename"); DBUG_PRINT("enter", ("from '%s'", from)); - if (from[0] == '#' && !strncmp(from, MYSQL50_TABLE_NAME_PREFIX, - MYSQL50_TABLE_NAME_PREFIX_LENGTH)) - DBUG_RETURN((uint) (strmake(to, from+MYSQL50_TABLE_NAME_PREFIX_LENGTH, - to_length-1) - - (from + MYSQL50_TABLE_NAME_PREFIX_LENGTH))); + if ((length= check_n_cut_mysql50_prefix(from, to, to_length))) + DBUG_RETURN(length); length= strconvert(system_charset_info, from, &my_charset_filename, to, to_length, &errors); if (check_if_legal_tablename(to) && diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 5c8b1d96646..108d5095691 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1368,15 +1368,27 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, if (triggers->on_table_names_list.push_back(on_table_name, &table->mem_root)) goto err_with_lex_cleanup; - +#ifndef DBUG_OFF /* Let us check that we correctly update trigger definitions when we rename tables with triggers. + + In special cases like "RENAME TABLE `#mysql50#somename` TO `somename`" + or "ALTER DATABASE `#mysql50#somename` UPGRADE DATA DIRECTORY NAME" + we might be given table or database name with "#mysql50#" prefix (and + trigger's definiton contains un-prefixed version of the same name). + To remove this prefix we use check_n_cut_mysql50_prefix(). */ - DBUG_ASSERT(!my_strcasecmp(table_alias_charset, lex.query_tables->db, db) && - !my_strcasecmp(table_alias_charset, lex.query_tables->table_name, - table_name)); + char fname[NAME_LEN + 1]; + DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->db, db) || + (check_n_cut_mysql50_prefix(db, fname, sizeof(fname)) && + !my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))) && + (!my_strcasecmp(table_alias_charset, lex.query_tables->table_name, + table_name) || + (check_n_cut_mysql50_prefix(table_name, fname, sizeof(fname)) && + !my_strcasecmp(table_alias_charset, lex.query_tables->table_name, fname)))); +#endif if (names_only) { lex_end(&lex); @@ -1692,7 +1704,8 @@ end: (change name of table in triggers' definitions). @param thd Thread context - @param db_name Database of subject table + @param old_db_name Old database of subject table + @param new_db_name New database of subject table @param old_table_name Old subject table's name @param new_table_name New subject table's name @@ -1704,7 +1717,8 @@ end: bool Table_triggers_list::change_table_name_in_triggers(THD *thd, - const char *db_name, + const char *old_db_name, + const char *new_db_name, LEX_STRING *old_table_name, LEX_STRING *new_table_name) { @@ -1757,11 +1771,11 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, if (thd->is_fatal_error) return TRUE; /* OOM */ - if (save_trigger_file(this, db_name, new_table_name->str)) + if (save_trigger_file(this, new_db_name, new_table_name->str)) return TRUE; - if (rm_trigger_file(path_buff, db_name, old_table_name->str)) + if (rm_trigger_file(path_buff, old_db_name, old_table_name->str)) { - (void) rm_trigger_file(path_buff, db_name, new_table_name->str); + (void) rm_trigger_file(path_buff, new_db_name, new_table_name->str); return TRUE; } return FALSE; @@ -1772,7 +1786,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, Iterate though Table_triggers_list::names_list list and update .TRN files after renaming triggers' subject table. - @param db_name Database of subject table + @param old_db_name Old database of subject table + @param new_db_name New database of subject table @param new_table_name New subject table's name @param stopper Pointer to Table_triggers_list::names_list at which we should stop updating. @@ -1785,7 +1800,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, */ LEX_STRING* -Table_triggers_list::change_table_name_in_trignames(const char *db_name, +Table_triggers_list::change_table_name_in_trignames(const char *old_db_name, + const char *new_db_name, LEX_STRING *new_table_name, LEX_STRING *stopper) { @@ -1798,7 +1814,7 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name, while ((trigger= it_name++) != stopper) { trigname_file.length= build_table_filename(trigname_buff, FN_REFLEN-1, - db_name, trigger->str, + new_db_name, trigger->str, TRN_EXT, 0); trigname_file.str= trigname_buff; @@ -1807,6 +1823,16 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name, if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type, (uchar*)&trigname, trigname_file_parameters)) return trigger; + + /* Remove stale .TRN file in case of database upgrade */ + if (old_db_name) + { + if (rm_trigname_file(trigname_buff, old_db_name, trigger->str)) + { + (void) rm_trigname_file(trigname_buff, new_db_name, trigger->str); + return trigger; + } + } } return 0; @@ -1840,6 +1866,7 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, { TABLE table; bool result= 0; + bool upgrading50to51= FALSE; LEX_STRING *err_trigname; DBUG_ENTER("change_table_name"); @@ -1877,14 +1904,27 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, moving table with them between two schemas raises too many questions. (E.g. what should happen if in new schema we already have trigger with same name ?). + + In case of "ALTER DATABASE `#mysql50#db1` UPGRADE DATA DIRECTORY NAME" + we will be given table name with "#mysql50#" prefix + To remove this prefix we use check_n_cut_mysql50_prefix(). */ if (my_strcasecmp(table_alias_charset, db, new_db)) { - my_error(ER_TRG_IN_WRONG_SCHEMA, MYF(0)); - result= 1; - goto end; + char dbname[NAME_LEN + 1]; + if (check_n_cut_mysql50_prefix(db, dbname, sizeof(dbname)) && + !my_strcasecmp(table_alias_charset, dbname, new_db)) + { + upgrading50to51= TRUE; + } + else + { + my_error(ER_TRG_IN_WRONG_SCHEMA, MYF(0)); + result= 1; + goto end; + } } - if (table.triggers->change_table_name_in_triggers(thd, db, + if (table.triggers->change_table_name_in_triggers(thd, db, new_db, &old_table_name, &new_table_name)) { @@ -1892,7 +1932,8 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, goto end; } if ((err_trigname= table.triggers->change_table_name_in_trignames( - db, &new_table_name, 0))) + upgrading50to51 ? db : NULL, + new_db, &new_table_name, 0))) { /* If we were unable to update one of .TRN files properly we will @@ -1900,16 +1941,17 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db, We assume that we will be able to undo our changes without errors (we can't do much if there will be an error anyway). */ - (void) table.triggers->change_table_name_in_trignames(db, - &old_table_name, - err_trigname); - (void) table.triggers->change_table_name_in_triggers(thd, db, - &new_table_name, - &old_table_name); + (void) table.triggers->change_table_name_in_trignames( + upgrading50to51 ? new_db : NULL, db, + &old_table_name, err_trigname); + (void) table.triggers->change_table_name_in_triggers( + thd, db, new_db, + &new_table_name, &old_table_name); result= 1; goto end; } } + end: delete table.triggers; free_root(&table.mem_root, MYF(0)); diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 1b0edf6bea8..f6754a75284 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -146,11 +146,13 @@ public: private: bool prepare_record1_accessors(TABLE *table); - LEX_STRING* change_table_name_in_trignames(const char *db_name, + LEX_STRING* change_table_name_in_trignames(const char *old_db_name, + const char *new_db_name, LEX_STRING *new_table_name, LEX_STRING *stopper); bool change_table_name_in_triggers(THD *thd, - const char *db_name, + const char *old_db_name, + const char *new_db_name, LEX_STRING *old_table_name, LEX_STRING *new_table_name); }; -- cgit v1.2.1 From ea75d58249232fe1be7665f60348d0ce1a2ecb44 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Jan 2009 20:16:10 +0100 Subject: Raise version number after cloning 5.0.76 --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 06586d6487e..12c31b33d1b 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.76) +AM_INIT_AUTOMAKE(mysql, 5.0.78) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 @@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=5 NDB_VERSION_MINOR=0 -NDB_VERSION_BUILD=76 +NDB_VERSION_BUILD=78 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? -- cgit v1.2.1 From 7a23cfaac93df76fbc804293f3607e638d0e29a1 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Thu, 15 Jan 2009 00:54:25 +0400 Subject: bug#33094: Error in upgrading from 5.0 to 5.1 when table contains triggers Post-fix test failure: fixed mysqlcheck.test on Windows platforms. mysql-test/r/mysqlcheck.result: fixed mysqlcheck.test on Windows platforms. mysql-test/t/mysqlcheck.test: fixed mysqlcheck.test on Windows platforms. --- mysql-test/r/mysqlcheck.result | 2 +- mysql-test/t/mysqlcheck.test | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 313cba51ec9..2febfcf7eb4 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -146,7 +146,7 @@ CREATE TABLE `я` (a INT); SET NAMES DEFAULT; mysqlcheck --default-character-set="latin1" --databases test test.? -Error : Table 'test.?' doesn't exist +Error : Table doesn't exist error : Corrupt mysqlcheck --default-character-set="utf8" --databases test test.я OK diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index b085cc5866a..7ecbc92f8f0 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -131,6 +131,8 @@ DROP TABLE `@`; CREATE TABLE `я` (a INT); SET NAMES DEFAULT; --echo mysqlcheck --default-character-set="latin1" --databases test +# Error returned depends on platform, replace it with "Table doesn't exist" +--replace_result "Can't find file: './test/@003f.frm' (errno: 22)" "Table doesn't exist" "Table 'test.?' doesn't exist" "Table doesn't exist" --exec $MYSQL_CHECK --default-character-set="latin1" --databases test --echo mysqlcheck --default-character-set="utf8" --databases test --exec $MYSQL_CHECK --default-character-set="utf8" --databases test -- cgit v1.2.1 From 09ac5c45eb19f276377107cd870c393ec4366eb8 Mon Sep 17 00:00:00 2001 From: MySQL Build Team Date: Thu, 15 Jan 2009 00:14:07 +0100 Subject: Oops, bumped version too high. Drop it back down from 5.0.78 to 5.0.77. --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 12c31b33d1b..ff0e9de9ec2 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 5.0.78) +AM_INIT_AUTOMAKE(mysql, 5.0.77) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 @@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0 # ndb version NDB_VERSION_MAJOR=5 NDB_VERSION_MINOR=0 -NDB_VERSION_BUILD=78 +NDB_VERSION_BUILD=77 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? -- cgit v1.2.1 From f6c8f94d11041efd1f485c1c01d92657ef98f34d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Jan 2009 16:48:10 +0100 Subject: Raise version number after cloning 5.1.31 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 919ab765118..185ade4273f 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM # # When changing major version number please also check switch statement # in mysqlbinlog::check_master_version(). -AM_INIT_AUTOMAKE(mysql, 5.1.31) +AM_INIT_AUTOMAKE(mysql, 5.1.32) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 -- cgit v1.2.1 From d5e10aec0815b7c34933d97dcbae2e8506fae00e Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 15 Jan 2009 18:35:21 +0100 Subject: Again, the branch designation "-bugteam" made it to the main tree, this should not happen. --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index e613cefc614..f044f8e62da 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.1-bugteam" +tree_name = "mysql-5.1" -- cgit v1.2.1
Post-Header for Intvar_log_eventBody for Rand_log_event
Name