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
3e4126e9
Commit
3e4126e9
authored
Jun 23, 2015
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.1' of github.com:MariaDB/server into 10.1
parents
fb3e3120
9b57b214
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
204 deletions
+161
-204
mysql-test/suite/perfschema/r/nesting.result
mysql-test/suite/perfschema/r/nesting.result
+113
-120
sql/my_apc.cc
sql/my_apc.cc
+0
-39
sql/my_apc.h
sql/my_apc.h
+23
-4
sql/sql_select.cc
sql/sql_select.cc
+23
-41
sql/sql_select.h
sql/sql_select.h
+2
-0
No files found.
mysql-test/suite/perfschema/r/nesting.result
View file @
3e4126e9
This diff is collapsed.
Click to expand it.
sql/my_apc.cc
View file @
3e4126e9
...
@@ -41,45 +41,6 @@ void Apc_target::init(mysql_mutex_t *target_mutex)
...
@@ -41,45 +41,6 @@ void Apc_target::init(mysql_mutex_t *target_mutex)
}
}
/*
Destroy the target. The target must be disabled when this call is made.
*/
void
Apc_target
::
destroy
()
{
DBUG_ASSERT
(
!
enabled
);
}
/*
Enter ther state where the target is available for serving APC requests
*/
void
Apc_target
::
enable
()
{
/* Ok to do without getting/releasing the mutex: */
enabled
++
;
}
/*
Make the target unavailable for serving APC requests.
@note
This call will serve all requests that were already enqueued
*/
void
Apc_target
::
disable
()
{
bool
process
=
FALSE
;
DBUG_ASSERT
(
enabled
);
mysql_mutex_lock
(
LOCK_thd_data_ptr
);
if
(
!
(
--
enabled
))
process
=
TRUE
;
mysql_mutex_unlock
(
LOCK_thd_data_ptr
);
if
(
process
)
process_apc_requests
();
}
/* [internal] Put request qe into the request list */
/* [internal] Put request qe into the request list */
void
Apc_target
::
enqueue_request
(
Call_request
*
qe
)
void
Apc_target
::
enqueue_request
(
Call_request
*
qe
)
...
...
sql/my_apc.h
View file @
3e4126e9
...
@@ -50,9 +50,28 @@ public:
...
@@ -50,9 +50,28 @@ public:
~
Apc_target
()
{
DBUG_ASSERT
(
!
enabled
&&
!
apc_calls
);}
~
Apc_target
()
{
DBUG_ASSERT
(
!
enabled
&&
!
apc_calls
);}
void
init
(
mysql_mutex_t
*
target_mutex
);
void
init
(
mysql_mutex_t
*
target_mutex
);
void
destroy
();
void
enable
();
/* Destroy the target. The target must be disabled when this call is made. */
void
disable
();
void
destroy
()
{
DBUG_ASSERT
(
!
enabled
);
}
/* Enter ther state where the target is available for serving APC requests */
void
enable
()
{
enabled
++
;
}
/*
Make the target unavailable for serving APC requests.
@note
This call will serve all requests that were already enqueued
*/
void
disable
()
{
DBUG_ASSERT
(
enabled
);
mysql_mutex_lock
(
LOCK_thd_data_ptr
);
bool
process
=
!--
enabled
&&
have_apc_requests
();
mysql_mutex_unlock
(
LOCK_thd_data_ptr
);
if
(
unlikely
(
process
))
process_apc_requests
();
}
void
process_apc_requests
();
void
process_apc_requests
();
/*
/*
...
...
sql/sql_select.cc
View file @
3e4126e9
...
@@ -276,10 +276,8 @@ Item_equal *find_item_equal(COND_EQUAL *cond_equal, Field *field,
...
@@ -276,10 +276,8 @@ Item_equal *find_item_equal(COND_EQUAL *cond_equal, Field *field,
JOIN_TAB
*
first_depth_first_tab
(
JOIN
*
join
);
JOIN_TAB
*
first_depth_first_tab
(
JOIN
*
join
);
JOIN_TAB
*
next_depth_first_tab
(
JOIN
*
join
,
JOIN_TAB
*
tab
);
JOIN_TAB
*
next_depth_first_tab
(
JOIN
*
join
,
JOIN_TAB
*
tab
);
enum
enum_exec_or_opt
{
WALK_OPTIMIZATION_TABS
,
WALK_EXECUTION_TABS
};
static
JOIN_TAB
*
next_breadth_first_tab
(
JOIN_TAB
*
first_top_tab
,
JOIN_TAB
*
first_breadth_first_tab
(
JOIN
*
join
,
enum
enum_exec_or_opt
tabs_kind
);
uint
n_top_tabs_count
,
JOIN_TAB
*
tab
);
JOIN_TAB
*
next_breadth_first_tab
(
JOIN
*
join
,
enum
enum_exec_or_opt
tabs_kind
,
JOIN_TAB
*
tab
);
static
double
table_cond_selectivity
(
JOIN
*
join
,
uint
idx
,
JOIN_TAB
*
s
,
static
double
table_cond_selectivity
(
JOIN
*
join
,
uint
idx
,
JOIN_TAB
*
s
,
table_map
rem_tables
);
table_map
rem_tables
);
...
@@ -7202,12 +7200,13 @@ double JOIN::get_examined_rows()
...
@@ -7202,12 +7200,13 @@ double JOIN::get_examined_rows()
{
{
double
examined_rows
;
double
examined_rows
;
double
prev_fanout
=
1
;
double
prev_fanout
=
1
;
JOIN_TAB
*
tab
=
first_breadth_first_
tab
(
this
,
WALK_OPTIMIZATION_TABS
);
JOIN_TAB
*
tab
=
first_breadth_first_
optimization_tab
(
);
JOIN_TAB
*
prev_tab
=
tab
;
JOIN_TAB
*
prev_tab
=
tab
;
examined_rows
=
tab
->
get_examined_rows
();
examined_rows
=
tab
->
get_examined_rows
();
while
((
tab
=
next_breadth_first_tab
(
this
,
WALK_OPTIMIZATION_TABS
,
tab
)))
while
((
tab
=
next_breadth_first_tab
(
first_breadth_first_optimization_tab
(),
top_table_access_tabs_count
,
tab
)))
{
{
prev_fanout
*=
prev_tab
->
records_read
;
prev_fanout
*=
prev_tab
->
records_read
;
examined_rows
+=
tab
->
get_examined_rows
()
*
prev_fanout
;
examined_rows
+=
tab
->
get_examined_rows
()
*
prev_fanout
;
...
@@ -8201,21 +8200,9 @@ prev_record_reads(POSITION *positions, uint idx, table_map found_ref)
...
@@ -8201,21 +8200,9 @@ prev_record_reads(POSITION *positions, uint idx, table_map found_ref)
Enumerate join tabs in breadth-first fashion, including const tables.
Enumerate join tabs in breadth-first fashion, including const tables.
*/
*/
JOIN_TAB
*
first_breadth_first_tab
(
JOIN
*
join
,
enum
enum_exec_or_opt
tabs_kind
)
static
JOIN_TAB
*
next_breadth_first_tab
(
JOIN_TAB
*
first_top_tab
,
uint
n_top_tabs_count
,
JOIN_TAB
*
tab
)
{
{
/* There's always one (i.e. first) table */
return
(
tabs_kind
==
WALK_EXECUTION_TABS
)
?
join
->
join_tab
:
join
->
table_access_tabs
;
}
JOIN_TAB
*
next_breadth_first_tab
(
JOIN
*
join
,
enum
enum_exec_or_opt
tabs_kind
,
JOIN_TAB
*
tab
)
{
JOIN_TAB
*
const
first_top_tab
=
first_breadth_first_tab
(
join
,
tabs_kind
);
const
uint
n_top_tabs_count
=
(
tabs_kind
==
WALK_EXECUTION_TABS
)
?
join
->
top_join_tab_count
:
join
->
top_table_access_tabs_count
;
if
(
!
tab
->
bush_root_tab
)
if
(
!
tab
->
bush_root_tab
)
{
{
/* We're at top level. Get the next top-level tab */
/* We're at top level. Get the next top-level tab */
...
@@ -8307,7 +8294,8 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls
...
@@ -8307,7 +8294,8 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls
JOIN_TAB
*
next_top_level_tab
(
JOIN
*
join
,
JOIN_TAB
*
tab
)
JOIN_TAB
*
next_top_level_tab
(
JOIN
*
join
,
JOIN_TAB
*
tab
)
{
{
tab
=
next_breadth_first_tab
(
join
,
WALK_EXECUTION_TABS
,
tab
);
tab
=
next_breadth_first_tab
(
join
->
first_breadth_first_execution_tab
(),
join
->
top_join_tab_count
,
tab
);
if
(
tab
&&
tab
->
bush_root_tab
)
if
(
tab
&&
tab
->
bush_root_tab
)
tab
=
NULL
;
tab
=
NULL
;
return
tab
;
return
tab
;
...
@@ -11800,27 +11788,21 @@ void JOIN::cleanup(bool full)
...
@@ -11800,27 +11788,21 @@ void JOIN::cleanup(bool full)
w/o tables: they don't have some members initialized and
w/o tables: they don't have some members initialized and
WALK_OPTIMIZATION_TABS may not work correctly for them.
WALK_OPTIMIZATION_TABS may not work correctly for them.
*/
*/
enum
enum_exec_or_opt
tabs_kind
;
if
(
first_breadth_first_tab
(
this
,
WALK_OPTIMIZATION_TABS
))
tabs_kind
=
WALK_OPTIMIZATION_TABS
;
else
tabs_kind
=
WALK_EXECUTION_TABS
;
if
(
table_count
)
if
(
table_count
)
{
{
for
(
tab
=
first_breadth_first_
tab
(
this
,
tabs_kind
);
tab
;
for
(
tab
=
first_breadth_first_
optimization_tab
(
);
tab
;
tab
=
next_breadth_first_tab
(
this
,
tabs_kind
,
tab
))
tab
=
next_breadth_first_tab
(
first_breadth_first_optimization_tab
(),
{
top_table_access_tabs_count
,
tab
))
tab
->
cleanup
();
tab
->
cleanup
();
}
if
(
tabs_kind
==
WALK_OPTIMIZATION_TABS
&&
/* We've walked optimization tabs, do execution ones too. */
first_breadth_first_tab
(
this
,
WALK_OPTIMIZATION_TABS
)
!=
if
(
first_breadth_first_execution_tab
()
!=
first_breadth_first_
tab
(
this
,
WALK_EXECUTION_TABS
))
first_breadth_first_
optimization_tab
(
))
{
{
JOIN_TAB
*
jt
=
first_breadth_first_tab
(
this
,
WALK_EXECUTION_TABS
)
;
for
(
tab
=
first_breadth_first_execution_tab
();
tab
;
/* We've walked optimization tabs. do execution ones too */
tab
=
next_breadth_first_tab
(
first_breadth_first_execution_tab
(),
if
(
jt
)
top_join_tab_count
,
tab
)
)
jt
->
cleanup
();
tab
->
cleanup
();
}
}
}
}
cleaned
=
true
;
cleaned
=
true
;
...
@@ -23556,13 +23538,13 @@ int append_possible_keys(MEM_ROOT *alloc, String_list &list, TABLE *table,
...
@@ -23556,13 +23538,13 @@ int append_possible_keys(MEM_ROOT *alloc, String_list &list, TABLE *table,
void
JOIN_TAB
::
update_explain_data
(
uint
idx
)
void
JOIN_TAB
::
update_explain_data
(
uint
idx
)
{
{
if
(
this
==
first_breadth_first_tab
(
join
,
WALK_OPTIMIZATION_TABS
)
+
join
->
const_tables
&&
if
(
this
==
join
->
first_breadth_first_optimization_tab
(
)
+
join
->
const_tables
&&
join
->
select_lex
->
select_number
!=
INT_MAX
&&
join
->
select_lex
->
select_number
!=
INT_MAX
&&
join
->
select_lex
->
select_number
!=
UINT_MAX
)
join
->
select_lex
->
select_number
!=
UINT_MAX
)
{
{
Explain_table_access
*
eta
=
new
(
join
->
thd
->
mem_root
)
Explain_table_access
(
join
->
thd
->
mem_root
);
Explain_table_access
*
eta
=
new
(
join
->
thd
->
mem_root
)
Explain_table_access
(
join
->
thd
->
mem_root
);
JOIN_TAB
*
const
first_top_tab
=
first_breadth_first_tab
(
join
,
WALK_OPTIMIZATION_TABS
);
save_explain_data
(
eta
,
join
->
const_table_map
,
join
->
select_distinct
,
save_explain_data
(
eta
,
join
->
const_table_map
,
join
->
select_distinct
,
first_top_tab
);
join
->
first_breadth_first_optimization_tab
()
);
Explain_select
*
sel
=
join
->
thd
->
lex
->
explain
->
get_select
(
join
->
select_lex
->
select_number
);
Explain_select
*
sel
=
join
->
thd
->
lex
->
explain
->
get_select
(
join
->
select_lex
->
select_number
);
idx
-=
my_count_bits
(
join
->
eliminated_tables
);
idx
-=
my_count_bits
(
join
->
eliminated_tables
);
...
@@ -24059,7 +24041,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
...
@@ -24059,7 +24041,7 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
xpl_sel
->
exec_const_cond
=
exec_const_cond
;
xpl_sel
->
exec_const_cond
=
exec_const_cond
;
JOIN_TAB
*
const
first_top_tab
=
first_breadth_first_tab
(
join
,
WALK_OPTIMIZATION_TABS
);
JOIN_TAB
*
const
first_top_tab
=
join
->
first_breadth_first_optimization_tab
(
);
JOIN_TAB
*
prev_bush_root_tab
=
NULL
;
JOIN_TAB
*
prev_bush_root_tab
=
NULL
;
Explain_basic_join
*
cur_parent
=
xpl_sel
;
Explain_basic_join
*
cur_parent
=
xpl_sel
;
...
...
sql/sql_select.h
View file @
3e4126e9
...
@@ -1531,6 +1531,8 @@ public:
...
@@ -1531,6 +1531,8 @@ public:
int
save_explain_data_intern
(
Explain_query
*
output
,
bool
need_tmp_table
,
int
save_explain_data_intern
(
Explain_query
*
output
,
bool
need_tmp_table
,
bool
need_order
,
bool
distinct
,
bool
need_order
,
bool
distinct
,
const
char
*
message
);
const
char
*
message
);
JOIN_TAB
*
first_breadth_first_optimization_tab
()
{
return
table_access_tabs
;
}
JOIN_TAB
*
first_breadth_first_execution_tab
()
{
return
join_tab
;
}
private:
private:
/**
/**
TRUE if the query contains an aggregate function but has no GROUP
TRUE if the query contains an aggregate function but has no GROUP
...
...
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