Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
a1b4eadf
Commit
a1b4eadf
authored
Dec 07, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#868908: Crash in check_simple_equality() with semijoin + materialization + prepared statement
- Part2: safety and code cleanup
parent
8e25dcfc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
22 deletions
+12
-22
sql/item_subselect.cc
sql/item_subselect.cc
+5
-2
sql/item_subselect.h
sql/item_subselect.h
+1
-1
sql/opt_subselect.cc
sql/opt_subselect.cc
+0
-10
sql/sql_select.cc
sql/sql_select.cc
+4
-7
sql/table.cc
sql/table.cc
+2
-2
No files found.
sql/item_subselect.cc
View file @
a1b4eadf
...
...
@@ -616,7 +616,7 @@ int Item_in_subselect::optimize(double *out_rows, double *cost)
thd
->
lex
->
current_select
=
join
->
select_lex
;
if
((
res
=
join
->
optimize
()))
DBUG_RETURN
(
res
);
//psergey-todo: subq predicate can be made forced const!
/* Calculate #rows and cost of join execution */
join
->
get_partial_cost_and_fanout
(
join
->
table_count
-
join
->
const_tables
,
table_map
(
-
1
),
...
...
@@ -1197,7 +1197,8 @@ Item_in_subselect::Item_in_subselect(Item * left_exp,
Item_exists_subselect
(),
left_expr_cache
(
0
),
first_execution
(
TRUE
),
in_strategy
(
SUBS_NOT_TRANSFORMED
),
optimizer
(
0
),
pushed_cond_guards
(
NULL
),
emb_on_expr_nest
(
NULL
),
is_jtbm_merged
(
FALSE
),
is_flattenable_semijoin
(
FALSE
),
is_jtbm_merged
(
FALSE
),
is_jtbm_const_tab
(
FALSE
),
is_flattenable_semijoin
(
FALSE
),
is_registered_semijoin
(
FALSE
),
upper_item
(
0
)
{
...
...
@@ -4182,6 +4183,8 @@ bool subselect_hash_sj_engine::init(List<Item> *tmp_columns, uint subquery_id)
*/
if
(
tmp_table
->
s
->
keys
==
0
)
{
//fprintf(stderr, "Q: %s\n", current_thd->query());
DBUG_ASSERT
(
0
);
DBUG_ASSERT
(
tmp_table
->
s
->
uniques
||
tmp_table
->
key_info
->
key_length
>=
tmp_table
->
file
->
max_key_length
()
||
...
...
sql/item_subselect.h
View file @
a1b4eadf
...
...
@@ -491,7 +491,7 @@ public:
:
Item_exists_subselect
(),
left_expr_cache
(
0
),
first_execution
(
TRUE
),
abort_on_null
(
0
),
in_strategy
(
SUBS_NOT_TRANSFORMED
),
optimizer
(
0
),
pushed_cond_guards
(
NULL
),
func
(
NULL
),
emb_on_expr_nest
(
NULL
),
is_jtbm_merged
(
FALSE
),
is_jtbm_merged
(
FALSE
),
is_jtbm_const_tab
(
FALSE
),
upper_item
(
0
)
{}
void
cleanup
();
...
...
sql/opt_subselect.cc
View file @
a1b4eadf
...
...
@@ -1431,21 +1431,11 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
DBUG_ENTER
(
"convert_subq_to_jtbm"
);
bool
optimization_delayed
=
TRUE
;
subq_pred
->
set_strategy
(
SUBS_MATERIALIZATION
);
// if (subq_pred->optimize(&rows, &read_time)) psergey-fix
// DBUG_RETURN(TRUE);
subq_pred
->
jtbm_read_time
=
read_time
;
subq_pred
->
jtbm_record_count
=
rows
;
subq_pred
->
is_jtbm_merged
=
TRUE
;
/* psergey-fix
if (subq_pred->engine->engine_type() != subselect_engine::HASH_SJ_ENGINE)
{
*remove_item= FALSE;
DBUG_RETURN(FALSE);
}
*/
*
remove_item
=
TRUE
;
TABLE_LIST
*
jtbm
;
...
...
sql/sql_select.cc
View file @
a1b4eadf
...
...
@@ -832,12 +832,12 @@ TABLE *create_dummy_tmp_table(THD *thd)
void
inject_jtbm_cond
s
(
JOIN
*
join
,
List
<
TABLE_LIST
>
*
join_list
,
Item
**
join_where
)
setup_jtbm_semi_join
s
(
JOIN
*
join
,
List
<
TABLE_LIST
>
*
join_list
,
Item
**
join_where
)
{
TABLE_LIST
*
table
;
NESTED_JOIN
*
nested_join
;
List_iterator
<
TABLE_LIST
>
li
(
*
join_list
);
DBUG_ENTER
(
"
inject_jtbm_cond
s"
);
DBUG_ENTER
(
"
setup_jtbm_semi_join
s"
);
while
((
table
=
li
++
))
...
...
@@ -880,7 +880,6 @@ inject_jtbm_conds(JOIN *join, List<TABLE_LIST> *join_list, Item **join_where)
table
->
table
->
pos_in_table_list
=
table
;
setup_table_map
(
table
->
table
,
table
,
table
->
jtbm_table_no
);
}
else
{
...
...
@@ -889,7 +888,6 @@ inject_jtbm_conds(JOIN *join, List<TABLE_LIST> *join_list, Item **join_where)
subselect_hash_sj_engine
*
hash_sj_engine
=
((
subselect_hash_sj_engine
*
)
item
->
engine
);
//repeat of convert_subq_to_jtbm:
table
->
table
=
hash_sj_engine
->
tmp_table
;
table
->
table
->
pos_in_table_list
=
table
;
...
...
@@ -900,13 +898,12 @@ inject_jtbm_conds(JOIN *join, List<TABLE_LIST> *join_list, Item **join_where)
(
*
join_where
)
=
and_items
(
*
join_where
,
sj_conds
);
if
(
!
(
*
join_where
)
->
fixed
)
(
*
join_where
)
->
fix_fields
(
join
->
thd
,
join_where
);
//parent_join->select_lex->where= parent_join->conds;
}
}
if
((
nested_join
=
table
->
nested_join
))
{
inject_jtbm_cond
s
(
join
,
&
nested_join
->
join_list
,
join_where
);
setup_jtbm_semi_join
s
(
join
,
&
nested_join
->
join_list
,
join_where
);
}
}
DBUG_VOID_RETURN
;
...
...
@@ -1036,7 +1033,7 @@ JOIN::optimize()
thd
->
restore_active_arena
(
arena
,
&
backup
);
}
inject_jtbm_cond
s
(
this
,
join_list
,
&
conds
);
setup_jtbm_semi_join
s
(
this
,
join_list
,
&
conds
);
conds
=
optimize_cond
(
this
,
conds
,
join_list
,
&
cond_value
,
&
cond_equal
);
...
...
sql/table.cc
View file @
a1b4eadf
...
...
@@ -5922,8 +5922,8 @@ bool TABLE_LIST::init_derived(THD *thd, bool init_view)
int
TABLE_LIST
::
fetch_number_of_rows
()
{
int
error
=
0
;
if
(
jtbm_subselect
)
/* psergey-todo: how did we work before? */
return
0
;
/*psergey-todo: check if we still need to set it? */
if
(
jtbm_subselect
)
return
0
;
if
(
is_materialized_derived
()
&&
!
fill_me
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment