From 620d42318bc8235342c502263e031d4a714f1c79 Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Tue, 7 Jun 2005 22:22:27 +0400 Subject: [PATCH 1/6] Enabling back part of sp.test which no longer fails in --ps-protocol mode (Bug which caused its failure before was fixed in the beginning of March by the ChangeSet that introduced improved SP-locking). --- mysql-test/t/sp.test | 8 -------- 1 file changed, 8 deletions(-) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 57d5d2939e1..5bd94f0ca7f 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -3267,12 +3267,6 @@ drop procedure bug8762| # # BUG#5240: Stored procedure crash if function has cursor declaration # -# The following test case fails in --ps-protocol mode due to some bugs -# in algorithm which calculates list of tables to be locked for queries -# using Stored Functions. It is disabled until Dmitri fixes this. -# ---disable_ps_protocol - --disable_warnings drop function if exists bug5240| --enable_warnings @@ -3292,8 +3286,6 @@ insert into t1 values ("answer", 42)| select id, bug5240() from t1| drop function bug5240| ---enable_ps_protocol - # # BUG#5278: Stored procedure packets out of order if SET PASSWORD. # From 79b82323e31f164fa96aeb38726ba0868a0a1991 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Wed, 8 Jun 2005 00:34:53 +0400 Subject: [PATCH 2/6] A followup patch for Bug#7306 (limit in prepared statements): don't evaluate subqueries during statement prepare, even if they are not correlated. With post-review fixes. --- sql/mysql_priv.h | 2 ++ sql/sql_lex.cc | 1 + sql/sql_lex.h | 1 + sql/sql_parse.cc | 14 ++++++++------ sql/sql_prepare.cc | 3 +++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index e8ec1b69959..338e45fa058 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -336,6 +336,8 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; #define UNCACHEABLE_SIDEEFFECT 4 // forcing to save JOIN for explain #define UNCACHEABLE_EXPLAIN 8 +/* Don't evaluate subqueries in prepare even if they're not correlated */ +#define UNCACHEABLE_PREPARE 16 #ifdef EXTRA_DEBUG /* diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 6b9330182d6..1270aab18ae 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1757,6 +1757,7 @@ void st_select_lex_unit::set_limit(SELECT_LEX *sl) { ulonglong select_limit_val; + DBUG_ASSERT(! thd->current_arena->is_stmt_prepare()); select_limit_val= sl->select_limit ? sl->select_limit->val_uint() : HA_POS_ERROR; offset_limit_cnt= sl->offset_limit ? sl->offset_limit->val_uint() : ULL(0); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 5022392565c..a6f729d7677 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -303,6 +303,7 @@ public: UNCACHEABLE_RAND UNCACHEABLE_SIDEEFFECT UNCACHEABLE_EXPLAIN + UNCACHEABLE_PREPARE */ uint8 uncacheable; enum sub_select_type linkage; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7d00cfa4c98..f48bc3713e6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5169,26 +5169,28 @@ bool mysql_new_select(LEX *lex, bool move_down) { SELECT_LEX *select_lex; - THD *thd; + THD *thd= lex->thd; DBUG_ENTER("mysql_new_select"); - if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX())) + if (!(select_lex= new (thd->mem_root) SELECT_LEX())) DBUG_RETURN(1); - select_lex->select_number= ++lex->thd->select_number; + select_lex->select_number= ++thd->select_number; select_lex->init_query(); select_lex->init_select(); select_lex->parent_lex= lex; + if (thd->current_arena->is_stmt_prepare()) + select_lex->uncacheable|= UNCACHEABLE_PREPARE; if (move_down) { SELECT_LEX_UNIT *unit; lex->subqueries= TRUE; /* first select_lex of subselect or derived table */ - if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT())) + if (!(unit= new (thd->mem_root) SELECT_LEX_UNIT())) DBUG_RETURN(1); unit->init_query(); unit->init_select(); - unit->thd= lex->thd; + unit->thd= thd; unit->include_down(lex->current_select); unit->link_next= 0; unit->link_prev= 0; @@ -5212,7 +5214,7 @@ mysql_new_select(LEX *lex, bool move_down) as far as we included SELECT_LEX for UNION unit should have fake SELECT_LEX for UNION processing */ - if (!(fake= unit->fake_select_lex= new(lex->thd->mem_root) SELECT_LEX())) + if (!(fake= unit->fake_select_lex= new (thd->mem_root) SELECT_LEX())) DBUG_RETURN(1); fake->include_standalone(unit, (SELECT_LEX_NODE**)&unit->fake_select_lex); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 1521b206e0d..4440e542434 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1838,7 +1838,10 @@ void init_stmt_after_parse(THD *thd, LEX *lex) optimisation. */ for (; sl; sl= sl->next_select_in_list()) + { sl->prep_where= sl->where; + sl->uncacheable&= ~UNCACHEABLE_PREPARE; + } for (TABLE_LIST *table= lex->query_tables; table; table= table->next_global) table->prep_on_expr= table->on_expr; From 6f8ef49895512ca062837525b2d4bba3177686ae Mon Sep 17 00:00:00 2001 From: "ramil@mysql.com" <> Date: Wed, 8 Jun 2005 11:37:43 +0500 Subject: [PATCH 3/6] A fix (bug #11153: Ambiguous call to overloaded function, acording to Visual Studio 6) --- sql/item_subselect.cc | 2 +- sql/sql_yacc.yy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 07c0ce2b6e3..7a72b78b6f4 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -601,7 +601,7 @@ void Item_exists_subselect::fix_length_and_dec() max_length= 1; max_columns= engine->cols(); /* We need only 1 row to determine existence */ - unit->global_parameters->select_limit= new Item_int(1); + unit->global_parameters->select_limit= new Item_int((int32) 1); } double Item_exists_subselect::val_real() diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e0529da9302..719b42e890f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7985,7 +7985,7 @@ handler: LEX *lex=Lex; 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(1); + lex->current_select->select_limit= new Item_int((int32) 1); lex->current_select->offset_limit= 0; if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0)) YYABORT; From 99c637477f8e9cd76e3afc02ab118db1febe0edd Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Wed, 8 Jun 2005 10:44:58 +0400 Subject: [PATCH 4/6] Fix ps_7ndb.result wrt working LIMIT clause (due to porting missed ityesterday :() --- mysql-test/r/ps_7ndb.result | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 3b071d70b93..d31f8c57513 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -442,9 +442,10 @@ limit 1 '; execute stmt1 ; a b 1 one -prepare stmt1 from ' select a,b from t1 -limit ? '; -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 2 +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; +a b +3 three set @arg00='b' ; set @arg01=0 ; set @arg02=2 ; From 51400b9a7919ed93144419da4f5b06c698ccdff8 Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Wed, 8 Jun 2005 10:59:40 +0400 Subject: [PATCH 5/6] Fix failing ps_6bdb and ps_7ndb tests. The changes are similar to those pushed with a fix for Bug#9899, so my guess is that ps_6dbd and ps_7ndb tests were simply not run then. --- mysql-test/r/ps_6bdb.result | 6 +++--- mysql-test/r/ps_7ndb.result | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 03b155c6fa4..92399c3b3b9 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -1152,13 +1152,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 253 4096 0 Y 128 31 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index d31f8c57513..c7dabc2016d 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1,4 +1,6 @@ -use test; drop table if exists t1, t9 ; create table t1 +use test; +drop table if exists t1, t9 ; +create table t1 ( a int, b varchar(30), primary key(a) @@ -1150,13 +1152,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 253 4096 0 Y 128 31 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 From a65c0b000a611dabd3ff359953895003217f0b14 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Wed, 8 Jun 2005 17:35:11 +1000 Subject: [PATCH 6/6] BUG#10893 Cluster hangs on initial startup IPCConfig wasn't constructing the connect string properly. --- ndb/src/common/mgmcommon/IPCConfig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/common/mgmcommon/IPCConfig.cpp b/ndb/src/common/mgmcommon/IPCConfig.cpp index f188a433f1b..f45bc6ead54 100644 --- a/ndb/src/common/mgmcommon/IPCConfig.cpp +++ b/ndb/src/common/mgmcommon/IPCConfig.cpp @@ -188,7 +188,7 @@ IPCConfig::configureTransporters(Uint32 nodeId, if(iter.get(CFG_NODE_HOST, &hostname)) continue; if( strlen(hostname) == 0 ) continue; if(iter.get(CFG_MGM_PORT, &port)) continue; - connect_string.appfmt("%s%s:port",separator,hostname,port); + connect_string.appfmt("%s%s:%u",separator,hostname,port); separator= ","; } NdbMgmHandle h= ndb_mgm_create_handle();