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
f7048e9a
Commit
f7048e9a
authored
May 12, 2016
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move common code to a separate function
parent
28641640
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
sql/table_cache.cc
sql/table_cache.cc
+28
-26
No files found.
sql/table_cache.cc
View file @
f7048e9a
...
...
@@ -152,6 +152,31 @@ static void tc_remove_table(TABLE *table)
}
static
void
tc_remove_all_unused_tables
(
TDC_element
*
element
,
TABLE_list
*
purge_tables
,
bool
mark_flushed
)
{
TABLE
*
table
;
element
->
wait_for_mdl_deadlock_detector
();
/*
Mark share flushed in order to ensure that it gets
automatically deleted once it is no longer referenced.
Note that code in TABLE_SHARE::wait_for_old_version() assumes that
marking share flushed is followed by purge of unused table
shares.
*/
if
(
mark_flushed
)
element
->
flushed
=
true
;
while
((
table
=
element
->
free_tables
.
pop_front
()))
{
tc_remove_table
(
table
);
purge_tables
->
push_front
(
table
);
}
}
/**
Free all unused TABLE objects.
...
...
@@ -176,17 +201,8 @@ struct tc_purge_arg
static
my_bool
tc_purge_callback
(
TDC_element
*
element
,
tc_purge_arg
*
arg
)
{
TABLE
*
table
;
mysql_mutex_lock
(
&
element
->
LOCK_table_share
);
element
->
wait_for_mdl_deadlock_detector
();
if
(
arg
->
mark_flushed
)
element
->
flushed
=
true
;
while
((
table
=
element
->
free_tables
.
pop_front
()))
{
tc_remove_table
(
table
);
arg
->
purge_tables
.
push_front
(
table
);
}
tc_remove_all_unused_tables
(
element
,
&
arg
->
purge_tables
,
arg
->
mark_flushed
);
mysql_mutex_unlock
(
&
element
->
LOCK_table_share
);
return
FALSE
;
}
...
...
@@ -880,23 +896,9 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
element
->
ref_count
++
;
element
->
wait_for_mdl_deadlock_detector
();
/*
Mark share flushed in order to ensure that it gets
automatically deleted once it is no longer referenced.
tc_remove_all_unused_tables
(
element
,
&
purge_tables
,
remove_type
!=
TDC_RT_REMOVE_NOT_OWN_KEEP_SHARE
);
Note that code in TABLE_SHARE::wait_for_old_version() assumes that
marking share flushed is followed by purge of unused table
shares.
*/
if
(
remove_type
!=
TDC_RT_REMOVE_NOT_OWN_KEEP_SHARE
)
element
->
flushed
=
true
;
while
((
table
=
element
->
free_tables
.
pop_front
()))
{
tc_remove_table
(
table
);
purge_tables
.
push_front
(
table
);
}
if
(
kill_delayed_threads
)
kill_delayed_threads_for_table
(
element
);
...
...
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