3382 Alexander Nozdrin 2011-05-06 [merge]
Manual merge from mysql-5.5.
modified:
sql/item.cc
sql/item_cmpfunc.cc
sql/item_func.cc
sql/item_row.cc
sql/item_strfunc.cc
sql/sql_class.h
3381 Jorgen Loland 2011-05-06
BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER
AWAY QUALIFYING ROWS
Preparation patch (does not include fix for the bug):
* Extensively document key_or()
* Remove tab indentations from key_or()
* Minor code changes like using existing utility functions
in key_or()
@ sql/opt_range.cc
Extensively document key_or(), remove tab indentations from key_or(), minor code changes like using existing utility functions in key_or()
******
In key_or(): When a range in key1 was split due to a
partially overlapping range in key2, the non-overlaping part
incorrectly got next_key_part from the R-B tree root node instead
of the currently active range. key_or() could also create
adjacent ranges that could be replaced by a single continous
range. This is also fixed.
modified:
sql/opt_range.cc
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2011-04-28 08:28:18 +0000
+++ b/sql/item.cc 2011-05-06 13:32:53 +0000
@@ -580,7 +580,7 @@ void Item::rename(char *new_name)
Item* Item::transform(Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->is_stmt_prepare());
+ DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
return (this->*transformer)(arg);
}
@@ -1800,14 +1800,17 @@ bool agg_item_set_converter(DTCollation
}
THD *thd= current_thd;
- Query_arena *arena, backup;
bool res= FALSE;
uint i;
+
/*
In case we're in statement prepare, create conversion item
in its memory: it will be reused on each execute.
*/
- arena= thd->activate_stmt_arena_if_needed(&backup);
+ Query_arena backup;
+ Query_arena *arena= thd->stmt_arena->is_stmt_prepare() ?
+ thd->activate_stmt_arena_if_needed(&backup) :
+ NULL;
for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
{
@@ -1864,7 +1867,7 @@ bool agg_item_set_converter(DTCollation
been created in prepare. In this case register the change for
rollback.
*/
- if (thd->is_stmt_prepare())
+ if (thd->stmt_arena->is_stmt_prepare())
*arg= conv;
else
thd->change_item_tree(arg, conv);
@@ -7098,7 +7101,7 @@ int Item_default_value::save_in_field(Fi
Item *Item_default_value::transform(Item_transformer transformer, uchar *args)
{
- DBUG_ASSERT(!current_thd->is_stmt_prepare());
+ DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
/*
If the value of arg is NULL, then this object represents a constant,
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2011-05-06 12:56:36 +0000
+++ b/sql/item_cmpfunc.cc 2011-05-06 13:32:53 +0000
@@ -2000,7 +2000,7 @@ Item *Item_in_optimizer::transform(Item_
{
Item *new_item;
- DBUG_ASSERT(!current_thd->is_stmt_prepare());
+ DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
DBUG_ASSERT(arg_count == 2);
/* Transform the left IN operand. */
@@ -4469,7 +4469,7 @@ bool Item_cond::walk(Item_processor proc
Item *Item_cond::transform(Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->is_stmt_prepare());
+ DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
List_iterator<Item> li(list);
Item *item;
@@ -5867,7 +5867,7 @@ bool Item_equal::walk(Item_processor pro
Item *Item_equal::transform(Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->is_stmt_prepare());
+ DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
List_iterator<Item_field> it(fields);
Item *item;
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2011-05-06 12:56:36 +0000
+++ b/sql/item_func.cc 2011-05-06 13:32:53 +0000
@@ -314,7 +314,7 @@ void Item_func::traverse_cond(Cond_trave
Item *Item_func::transform(Item_transformer transformer, uchar *argument)
{
- DBUG_ASSERT(!current_thd->is_stmt_prepare());
+ DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
if (arg_count)
{
=== modified file 'sql/item_row.cc'
--- a/sql/item_row.cc 2011-03-08 19:14:42 +0000
+++ b/sql/item_row.cc 2011-05-06 13:32:53 +0000
@@ -184,7 +184,7 @@ bool Item_row::walk(Item_processor proce
Item *Item_row::transform(Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->is_stmt_prepare());
+ DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
for (uint i= 0; i < arg_count; i++)
{
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc 2011-04-15 09:04:21 +0000
+++ b/sql/item_strfunc.cc 2011-05-06 13:32:53 +0000
@@ -2629,7 +2629,7 @@ String *Item_func_make_set::val_str(Stri
Item *Item_func_make_set::transform(Item_transformer transformer, uchar *arg)
{
- DBUG_ASSERT(!current_thd->is_stmt_prepare());
+ DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
Item *new_item= item->transform(transformer, arg);
if (!new_item)
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-05-04 07:51:15 +0000
+++ b/sql/sql_class.h 2011-05-06 13:32:53 +0000
@@ -696,15 +696,10 @@ public:
virtual ~Query_arena() {};
inline bool is_stmt_prepare() const { return state == INITIALIZED; }
- inline bool is_first_sp_execute() const
- { return state == INITIALIZED_FOR_SP; }
inline bool is_stmt_prepare_or_first_sp_execute() const
{ return (int)state < (int)PREPARED; }
inline bool is_stmt_prepare_or_first_stmt_execute() const
{ return (int)state <= (int)PREPARED; }
- inline bool is_first_stmt_execute() const { return state == PREPARED; }
- inline bool is_stmt_execute() const
- { return state == PREPARED || state == EXECUTED; }
inline bool is_conventional() const
{ return state == CONVENTIONAL_EXECUTION; }
@@ -1478,6 +1473,19 @@ class THD :public Statement,
public Open_tables_state,
public MDL_context_owner
{
+private:
+ inline bool is_stmt_prepare() const
+ { DBUG_ASSERT(0); return Statement::is_stmt_prepare(); }
+
+ inline bool is_stmt_prepare_or_first_sp_execute() const
+ { DBUG_ASSERT(0); return Statement::is_stmt_prepare_or_first_sp_execute(); }
+
+ inline bool is_stmt_prepare_or_first_stmt_execute() const
+ { DBUG_ASSERT(0); return Statement::is_stmt_prepare_or_first_stmt_execute(); }
+
+ inline bool is_conventional() const
+ { DBUG_ASSERT(0); return Statement::is_conventional(); }
+
public:
MDL_context mdl_context;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (alexander.nozdrin:3381 to 3382) | Alexander Nozdrin | 6 May |