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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
584cfcbe
Commit
584cfcbe
authored
Aug 18, 2012
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made the process of collecting persistent statistics killable.
parent
85db0298
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
sql/sql_admin.cc
sql/sql_admin.cc
+2
-0
sql/sql_statistics.cc
sql/sql_statistics.cc
+10
-4
No files found.
sql/sql_admin.cc
View file @
584cfcbe
...
@@ -716,6 +716,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
...
@@ -716,6 +716,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
!
(
compl_result_code
=
!
(
compl_result_code
=
collect_statistics_for_table
(
thd
,
table
->
table
)))
collect_statistics_for_table
(
thd
,
table
->
table
)))
compl_result_code
=
update_statistics_for_table
(
thd
,
table
->
table
);
compl_result_code
=
update_statistics_for_table
(
thd
,
table
->
table
);
if
(
compl_result_code
)
result_code
=
HA_ADMIN_FAILED
;
}
}
if
(
result_code
==
HA_ADMIN_NOT_IMPLEMENTED
&&
need_repair_or_alter
)
if
(
result_code
==
HA_ADMIN_NOT_IMPLEMENTED
&&
need_repair_or_alter
)
...
...
sql/sql_statistics.cc
View file @
584cfcbe
...
@@ -1926,7 +1926,7 @@ void Column_statistics_collected::finish(ha_rows rows)
...
@@ -1926,7 +1926,7 @@ void Column_statistics_collected::finish(ha_rows rows)
*/
*/
static
static
int
collect_statistics_for_index
(
TABLE
*
table
,
uint
index
)
int
collect_statistics_for_index
(
T
HD
*
thd
,
T
ABLE
*
table
,
uint
index
)
{
{
int
rc
=
0
;
int
rc
=
0
;
KEY
*
key_info
=
&
table
->
key_info
[
index
];
KEY
*
key_info
=
&
table
->
key_info
[
index
];
...
@@ -1944,6 +1944,9 @@ int collect_statistics_for_index(TABLE *table, uint index)
...
@@ -1944,6 +1944,9 @@ int collect_statistics_for_index(TABLE *table, uint index)
rc
=
table
->
file
->
ha_index_first
(
table
->
record
[
0
]);
rc
=
table
->
file
->
ha_index_first
(
table
->
record
[
0
]);
while
(
rc
!=
HA_ERR_END_OF_FILE
)
while
(
rc
!=
HA_ERR_END_OF_FILE
)
{
{
if
(
thd
->
killed
)
break
;
if
(
rc
)
if
(
rc
)
break
;
break
;
rows
++
;
rows
++
;
...
@@ -1953,7 +1956,7 @@ int collect_statistics_for_index(TABLE *table, uint index)
...
@@ -1953,7 +1956,7 @@ int collect_statistics_for_index(TABLE *table, uint index)
table
->
key_read
=
0
;
table
->
key_read
=
0
;
table
->
file
->
ha_index_end
();
table
->
file
->
ha_index_end
();
rc
=
(
rc
==
HA_ERR_END_OF_FILE
)
?
0
:
1
;
rc
=
(
rc
==
HA_ERR_END_OF_FILE
&&
!
thd
->
killed
)
?
0
:
1
;
if
(
!
rc
)
if
(
!
rc
)
index_prefix_calc
.
get_avg_frequency
();
index_prefix_calc
.
get_avg_frequency
();
...
@@ -2040,6 +2043,9 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
...
@@ -2040,6 +2043,9 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
{
{
while
((
rc
=
file
->
ha_rnd_next
(
table
->
record
[
0
]))
!=
HA_ERR_END_OF_FILE
)
while
((
rc
=
file
->
ha_rnd_next
(
table
->
record
[
0
]))
!=
HA_ERR_END_OF_FILE
)
{
{
if
(
thd
->
killed
)
break
;
if
(
rc
)
if
(
rc
)
break
;
break
;
...
@@ -2054,7 +2060,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
...
@@ -2054,7 +2060,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
}
}
file
->
ha_rnd_end
();
file
->
ha_rnd_end
();
}
}
rc
=
rc
==
HA_ERR_END_OF_FILE
?
0
:
1
;
rc
=
(
rc
==
HA_ERR_END_OF_FILE
&&
!
thd
->
killed
)
?
0
:
1
;
/*
/*
Calculate values for all statistical characteristics on columns and
Calculate values for all statistical characteristics on columns and
...
@@ -2087,7 +2093,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
...
@@ -2087,7 +2093,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
/* Collect statistics for indexes */
/* Collect statistics for indexes */
while
((
key
=
it
++
)
!=
key_map
::
Iterator
::
BITMAP_END
)
while
((
key
=
it
++
)
!=
key_map
::
Iterator
::
BITMAP_END
)
{
{
if
((
rc
=
collect_statistics_for_index
(
table
,
key
)))
if
((
rc
=
collect_statistics_for_index
(
t
hd
,
t
able
,
key
)))
break
;
break
;
}
}
...
...
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