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
a81fbbc6
Commit
a81fbbc6
authored
Dec 23, 2020
by
Nikita Malyavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handler0alter.cc: extract cache eviction and stats drop to functions
parent
e59c1cef
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
42 deletions
+44
-42
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+44
-42
No files found.
storage/innobase/handler/handler0alter.cc
View file @
a81fbbc6
...
...
@@ -8762,6 +8762,44 @@ innobase_page_compression_try(
DBUG_RETURN
(
false
);
}
static
void
dict_stats_try_drop_table
(
THD
*
thd
,
const
table_name_t
&
name
,
const
LEX_CSTRING
&
table_name
)
{
char
errstr
[
1024
];
if
(
dict_stats_drop_table
(
name
.
m_name
,
errstr
,
sizeof
(
errstr
))
!=
DB_SUCCESS
)
{
push_warning_printf
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
ER_ALTER_INFO
,
"Deleting persistent statistics"
" for table '%s' in InnoDB failed: %s"
,
table_name
.
str
,
errstr
);
}
}
/** Evict the table from cache and reopen it. Drop outdated statistics.
@param thd mariadb THD entity
@param table innodb table
@param maria_table_name user-friendly table name for errors
@return newly opened table */
static
dict_table_t
*
innobase_reload_table
(
THD
*
thd
,
dict_table_t
*
table
,
const
LEX_CSTRING
&
table_name
)
{
char
*
tb_name
=
strdup
(
table
->
name
.
m_name
);
dict_table_close
(
table
,
true
,
false
);
dict_table_remove_from_cache
(
table
);
table
=
dict_table_open_on_name
(
tb_name
,
TRUE
,
TRUE
,
DICT_ERR_IGNORE_FK_NOKEY
);
/* Drop outdated table stats. */
dict_stats_try_drop_table
(
thd
,
table
->
name
,
table_name
);
free
(
tb_name
);
return
table
;
}
/** Commit the changes made during prepare_inplace_alter_table()
and inplace_alter_table() inside the data dictionary tables,
when not rebuilding the table.
...
...
@@ -9862,35 +9900,12 @@ ha_innobase::commit_inplace_alter_table(
}
if
(
ctx0
->
num_to_drop_vcol
||
ctx0
->
num_to_add_vcol
)
{
/* FIXME: this workaround does not seem to work with
partitioned tables */
DBUG_ASSERT
(
ctx0
->
old_table
->
get_ref_count
()
==
1
);
trx_commit_for_mysql
(
m_prebuilt
->
trx
);
char
tb_name
[
NAME_LEN
*
2
+
1
+
1
];
strcpy
(
tb_name
,
m_prebuilt
->
table
->
name
.
m_name
);
dict_table_close
(
m_prebuilt
->
table
,
true
,
false
);
dict_table_remove_from_cache
(
m_prebuilt
->
table
);
m_prebuilt
->
table
=
dict_table_open_on_name
(
tb_name
,
TRUE
,
TRUE
,
DICT_ERR_IGNORE_FK_NOKEY
);
/* Drop outdated table stats. */
char
errstr
[
1024
];
if
(
dict_stats_drop_table
(
m_prebuilt
->
table
->
name
.
m_name
,
errstr
,
sizeof
(
errstr
))
!=
DB_SUCCESS
)
{
push_warning_printf
(
m_user_thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
ER_ALTER_INFO
,
"Deleting persistent statistics"
" for table '%s' in"
" InnoDB failed: %s"
,
table
->
s
->
table_name
.
str
,
errstr
);
}
m_prebuilt
->
table
=
innobase_reload_table
(
m_user_thd
,
m_prebuilt
->
table
,
table
->
s
->
table_name
);
row_mysql_unlock_data_dictionary
(
trx
);
trx
->
free
();
...
...
@@ -9950,8 +9965,6 @@ ha_innobase::commit_inplace_alter_table(
old copy of the table (which was renamed to
ctx->tmp_name). */
char
errstr
[
1024
];
DBUG_ASSERT
(
0
==
strcmp
(
ctx
->
old_table
->
name
.
m_name
,
ctx
->
tmp_name
));
...
...
@@ -9960,20 +9973,9 @@ ha_innobase::commit_inplace_alter_table(
DBUG_SET
(
"+d,innodb_report_deadlock"
);
);
if
(
dict_stats_drop_table
(
ctx
->
new_table
->
name
.
m_name
,
errstr
,
sizeof
(
errstr
))
!=
DB_SUCCESS
)
{
push_warning_printf
(
m_user_thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
ER_ALTER_INFO
,
"Deleting persistent statistics"
" for rebuilt table '%s' in"
" InnoDB failed: %s"
,
table
->
s
->
table_name
.
str
,
errstr
);
}
dict_stats_try_drop_table
(
m_user_thd
,
ctx
->
new_table
->
name
,
table
->
s
->
table_name
);
DBUG_EXECUTE_IF
(
"ib_rename_index_fail3"
,
...
...
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