diff options
author | unknown <msvensson@pilot.blaudden> | 2007-05-18 12:58:11 +0200 |
---|---|---|
committer | unknown <msvensson@pilot.blaudden> | 2007-05-18 12:58:11 +0200 |
commit | 768eab64a12fd546602a265827d1eb410a21c808 (patch) | |
tree | 602f90627277a3a014320f20e2933fc335a50318 | |
parent | 421d8ca9728ff882780599ce36cfa20936c7863e (diff) | |
parent | fde76b7e546f0e8ac66d8c8fb7e4a0e72254c7f0 (diff) | |
download | mariadb-git-768eab64a12fd546602a265827d1eb410a21c808.tar.gz |
Merge bk-internal:/home/bk/mysql-4.1-maint
into pilot.blaudden:/home/msvensson/mysql/mysql-4.1-maint
-rw-r--r-- | mysql-test/r/cast.result | 6 | ||||
-rw-r--r-- | mysql-test/r/join.result | 50 | ||||
-rw-r--r-- | mysql-test/r/query_cache.result | 52 | ||||
-rw-r--r-- | mysql-test/t/cast.test | 6 | ||||
-rw-r--r-- | mysql-test/t/join.test | 24 | ||||
-rw-r--r-- | mysql-test/t/query_cache.test | 46 | ||||
-rw-r--r-- | ndb/src/mgmclient/CommandInterpreter.cpp | 3 | ||||
-rw-r--r-- | sql/item_func.cc | 6 | ||||
-rw-r--r-- | sql/mysql_priv.h | 1 | ||||
-rw-r--r-- | sql/set_var.cc | 8 | ||||
-rw-r--r-- | sql/sql_cache.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 9 | ||||
-rw-r--r-- | support-files/mysql.spec.sh | 2 |
13 files changed, 206 insertions, 9 deletions
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 23c38bb792c..f6f46bd4079 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -281,4 +281,10 @@ DROP TABLE t1; select isnull(date(NULL)), isnull(cast(NULL as DATE)); isnull(date(NULL)) isnull(cast(NULL as DATE)) 1 1 +SELECT CAST(cast('01-01-01' as date) AS UNSIGNED); +CAST(cast('01-01-01' as date) AS UNSIGNED) +20010101 +SELECT CAST(cast('01-01-01' as date) AS SIGNED); +CAST(cast('01-01-01' as date) AS SIGNED) +20010101 End of 4.1 tests diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index dc763472b0e..9ac8825fcb8 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -376,3 +376,53 @@ i i i 2 NULL 4 2 2 2 drop table t1,t2,t3; +CREATE TABLE t1 (a int, b int default 0, c int default 1); +INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8); +INSERT INTO t1 (a) SELECT a + 8 FROM t1; +INSERT INTO t1 (a) SELECT a + 16 FROM t1; +CREATE TABLE t2 (a int, d int, e int default 0); +INSERT INTO t2 (a, d) VALUES (1,1),(2,2),(3,3),(4,4); +INSERT INTO t2 (a, d) SELECT a+4, a+4 FROM t2; +INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2; +EXPLAIN +SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e +ORDER BY t1.b, t1.c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 32 Using temporary; Using filesort +1 SIMPLE t2 ALL NULL NULL NULL NULL 16 Using where +SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e +ORDER BY t1.b, t1.c; +e +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +DROP TABLE t1,t2; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 24363ea27ab..4d0c262898b 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1008,3 +1008,55 @@ Variable_name Value Qcache_hits 1 drop table t1; set GLOBAL query_cache_size=0; +create table t1 (a int); +insert into t1 values (1),(2),(3); +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; +reset query cache; +set LOCAL default_week_format = 0; +select week('2007-01-04'); +week('2007-01-04') +0 +select week('2007-01-04') from t1; +week('2007-01-04') +0 +0 +0 +set LOCAL default_week_format = 2; +select week('2007-01-04'); +week('2007-01-04') +53 +select week('2007-01-04') from t1; +week('2007-01-04') +53 +53 +53 +drop table t1; +CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); +INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), +('Full-text indexes', 'are called collections'), +('Only MyISAM tables','support collections'), +('Function MATCH ... AGAINST()','is used to do a search'), +('Full-text search in MySQL', 'implements vector space model'); +set GLOBAL ft_boolean_syntax='+ -><()~*:""&|'; +select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; +a b x +MySQL has now support for full-text search 0 +Full-text indexes are called collections 1 +Only MyISAM tables support collections 0 +Function MATCH ... AGAINST() is used to do a search 0 +Full-text search in MySQL implements vector space model 0 +set GLOBAL ft_boolean_syntax='- +><()~*:""&|'; +select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; +a b x +MySQL has now support for full-text search 0 +Full-text indexes are called collections 0 +Only MyISAM tables support collections 0 +Function MATCH ... AGAINST() is used to do a search 0 +Full-text search in MySQL implements vector space model 0 +set GLOBAL query_cache_type=default; +set GLOBAL query_cache_limit=default; +set GLOBAL query_cache_min_res_unit=default; +set GLOBAL query_cache_size=default; diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 7e8ef031e6b..8eef66f9e1b 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -173,4 +173,10 @@ DROP TABLE t1; select isnull(date(NULL)), isnull(cast(NULL as DATE)); +# +# Bug#23656: Wrong result of CAST from DATE to int +# +SELECT CAST(cast('01-01-01' as date) AS UNSIGNED); +SELECT CAST(cast('01-01-01' as date) AS SIGNED); + --echo End of 4.1 tests diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 2715f30b6cf..0fe5de8c9b7 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -326,4 +326,28 @@ select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i; select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i; drop table t1,t2,t3; +# +# Bug #27531: Query performance degredation in 4.1.22 and greater +# +CREATE TABLE t1 (a int, b int default 0, c int default 1); + +INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8); +INSERT INTO t1 (a) SELECT a + 8 FROM t1; +INSERT INTO t1 (a) SELECT a + 16 FROM t1; + +CREATE TABLE t2 (a int, d int, e int default 0); + +INSERT INTO t2 (a, d) VALUES (1,1),(2,2),(3,3),(4,4); +INSERT INTO t2 (a, d) SELECT a+4, a+4 FROM t2; +INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2; + +# should use join cache +EXPLAIN +SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e + ORDER BY t1.b, t1.c; +SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e + ORDER BY t1.b, t1.c; + +DROP TABLE t1,t2; + # End of 4.1 tests diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 3140739309e..d447df9187b 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -729,4 +729,50 @@ drop table t1; set GLOBAL query_cache_size=0; +# +# Bug #27792 query cache returns wrong result, with certain system variables +# + +create table t1 (a int); +insert into t1 values (1),(2),(3); +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; + +# default_week_format +reset query cache; +set LOCAL default_week_format = 0; +select week('2007-01-04'); +select week('2007-01-04') from t1; + +set LOCAL default_week_format = 2; +select week('2007-01-04'); +select week('2007-01-04') from t1; + +drop table t1; + +CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); +INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), + ('Full-text indexes', 'are called collections'), + ('Only MyISAM tables','support collections'), + ('Function MATCH ... AGAINST()','is used to do a search'), + ('Full-text search in MySQL', 'implements vector space model'); + + +set GLOBAL ft_boolean_syntax='+ -><()~*:""&|'; + +select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; + +# swap +/- +set GLOBAL ft_boolean_syntax='- +><()~*:""&|'; + +select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1; + +set GLOBAL query_cache_type=default; +set GLOBAL query_cache_limit=default; +set GLOBAL query_cache_min_res_unit=default; +set GLOBAL query_cache_size=default; + + # End of 4.1 tests diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index ea5dc218898..e38c1109077 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -1629,6 +1629,7 @@ CommandInterpreter::executeStatus(int processId, } if (cl->node_states[i].node_type != NDB_MGM_NODE_TYPE_NDB){ if (cl->node_states[i].version != 0){ + version = cl->node_states[i].version; ndbout << "Node "<< cl->node_states[i].node_id <<": connected" ; ndbout_c(" (Version %d.%d.%d)", getMajor(version) , @@ -1638,7 +1639,7 @@ CommandInterpreter::executeStatus(int processId, }else ndbout << "Node "<< cl->node_states[i].node_id <<": not connected" << endl; return 0; - } + } status = cl->node_states[i].node_status; startPhase = cl->node_states[i].start_phase; version = cl->node_states[i].version; diff --git a/sql/item_func.cc b/sql/item_func.cc index c6b2fa5cc3e..12bb6571369 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -477,7 +477,8 @@ longlong Item_func_signed::val_int() longlong value; int error; - if (args[0]->cast_to_int_type() != STRING_RESULT) + if (args[0]->cast_to_int_type() != STRING_RESULT || + args[0]->result_as_longlong()) { value= args[0]->val_int(); null_value= args[0]->null_value; @@ -529,7 +530,8 @@ longlong Item_func_unsigned::val_int() return (longlong) (dvalue + (dvalue > 0 ? 0.5 : -0.5)); } - if (args[0]->cast_to_int_type() != STRING_RESULT) + if (args[0]->cast_to_int_type() != STRING_RESULT || + args[0]->result_as_longlong()) { value= args[0]->val_int(); null_value= args[0]->null_value; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index e5ac91e1814..6bd60280399 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -426,6 +426,7 @@ struct Query_cache_query_flags ulong sql_mode; ulong max_sort_length; ulong group_concat_max_len; + ulong default_week_format; MY_LOCALE *lc_time_names; }; #define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags) diff --git a/sql/set_var.cc b/sql/set_var.cc index 57bb93ef4b1..520ee5c9f70 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -490,7 +490,7 @@ static sys_var_rand_seed1 sys_rand_seed1("rand_seed1"); static sys_var_rand_seed2 sys_rand_seed2("rand_seed2"); static sys_var_thd_ulong sys_default_week_format("default_week_format", - &SV::default_week_format); + &SV::default_week_format); sys_var_thd_ulong sys_group_concat_max_len("group_concat_max_len", &SV::group_concat_max_len); @@ -992,7 +992,6 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex, return 0; } - static bool sys_update_init_connect(THD *thd, set_var *var) { return update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, var); @@ -1032,6 +1031,11 @@ static bool sys_update_ftb_syntax(THD *thd, set_var * var) { strmake(ft_boolean_syntax, var->value->str_value.c_ptr(), sizeof(ft_boolean_syntax)-1); + +#ifdef HAVE_QUERY_CACHE + query_cache.flush(); +#endif /* HAVE_QUERY_CACHE */ + return 0; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index fc03e03dee7..ee26bda3307 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -813,6 +813,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) flags.sql_mode= thd->variables.sql_mode; flags.max_sort_length= thd->variables.max_sort_length; flags.group_concat_max_len= thd->variables.group_concat_max_len; + flags.default_week_format= thd->variables.default_week_format; flags.lc_time_names= thd->variables.lc_time_names; STRUCT_LOCK(&structure_guard_mutex); @@ -1016,6 +1017,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) flags.sql_mode= thd->variables.sql_mode; flags.max_sort_length= thd->variables.max_sort_length; flags.group_concat_max_len= thd->variables.group_concat_max_len; + flags.default_week_format= thd->variables.default_week_format; flags.lc_time_names= thd->variables.lc_time_names; memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)), &flags, QUERY_CACHE_FLAGS_SIZE); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 36a15841065..656d1b5639a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3939,14 +3939,17 @@ make_join_readinfo(JOIN *join, uint options) disable join cache because it will change the ordering of the results. Code handles sort table that is at any location (not only first after the const tables) despite the fact that it's currently prohibited. + We must disable join cache if the first non-const table alone is + ordered. If there is a temp table the ordering is done as a last + operation and doesn't prevent join cache usage. */ - if (!ordered_set && - (table == join->sort_by_table && + if (!ordered_set && !join->need_tmp && + ((table == join->sort_by_table && (!join->order || join->skip_sort_order || test_if_skip_sort_order(tab, join->order, join->select_limit, 1)) ) || - (join->sort_by_table == (TABLE *) 1 && i != join->const_tables)) + (join->sort_by_table == (TABLE *) 1 && i != join->const_tables))) ordered_set= 1; switch (tab->type) { diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index ab544b65f74..b28af51d43e 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -556,7 +556,7 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1* -%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1 +%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql.server.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqltest.1* |