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
7cbd9e8d
Commit
7cbd9e8d
authored
Aug 26, 2010
by
Alexey Kopytov
Browse files
Options
Browse Files
Download
Plain Diff
Automerge.
parents
5ea747dc
adcfbfac
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
0 deletions
+71
-0
storage/innobase/include/dict0dict.h
storage/innobase/include/dict0dict.h
+16
-0
storage/innobase/include/dict0dict.ic
storage/innobase/include/dict0dict.ic
+42
-0
storage/innobase/row/row0mysql.c
storage/innobase/row/row0mysql.c
+13
-0
No files found.
storage/innobase/include/dict0dict.h
View file @
7cbd9e8d
...
...
@@ -588,6 +588,22 @@ dict_table_is_comp_noninline(
/* out: TRUE if table uses the
compact page format */
const
dict_table_t
*
table
);
/* in: table */
/*********************************************************************//**
Obtain exclusive locks on all index trees of the table. This is to prevent
accessing index trees while InnoDB is updating internal metadata for
operations such as truncate tables. */
UNIV_INLINE
void
dict_table_x_lock_indexes
(
/*======================*/
dict_table_t
*
table
);
/* in: table */
/*********************************************************************//**
Release the exclusive locks on all index tree. */
UNIV_INLINE
void
dict_table_x_unlock_indexes
(
/*========================*/
dict_table_t
*
table
);
/* in: table */
/************************************************************************
Checks if a column is in the ordering columns of the clustered index of a
table. Column prefixes are treated like whole columns. */
...
...
storage/innobase/include/dict0dict.ic
View file @
7cbd9e8d
...
...
@@ -298,6 +298,48 @@ dict_table_is_comp(
return(UNIV_LIKELY(table->flags & DICT_TF_COMPACT));
}
/*********************************************************************//**
Obtain exclusive locks on all index trees of the table. This is to prevent
accessing index trees while InnoDB is updating internal metadata for
operations such as truncate tables. */
UNIV_INLINE
void
dict_table_x_lock_indexes(
/*======================*/
dict_table_t* table) /* in: table */
{
dict_index_t* index;
ut_a(table);
ut_ad(mutex_own(&(dict_sys->mutex)));
/* Loop through each index of the table and lock them */
for (index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
rw_lock_x_lock(dict_index_get_lock(index));
}
}
/*********************************************************************//**
Release the exclusive locks on all index tree. */
UNIV_INLINE
void
dict_table_x_unlock_indexes(
/*========================*/
dict_table_t* table) /* in: table */
{
dict_index_t* index;
ut_a(table);
ut_ad(mutex_own(&(dict_sys->mutex)));
for (index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
rw_lock_x_unlock(dict_index_get_lock(index));
}
}
/************************************************************************
Gets the number of fields in the internal representation of an index,
including fields added by the dictionary system. */
...
...
storage/innobase/row/row0mysql.c
View file @
7cbd9e8d
...
...
@@ -2830,6 +2830,15 @@ row_truncate_table_for_mysql(
trx
->
table_id
=
table
->
id
;
/* Lock all index trees for this table, as we will
truncate the table/index and possibly change their metadata.
All DML/DDL are blocked by table level lock, with
a few exceptions such as queries into information schema
about the table, MySQL could try to access index stats
for this kind of query, we need to use index locks to
sync up */
dict_table_x_lock_indexes
(
table
);
/* scan SYS_INDEXES for all indexes of the table */
heap
=
mem_heap_create
(
800
);
...
...
@@ -2902,6 +2911,10 @@ row_truncate_table_for_mysql(
mem_heap_free
(
heap
);
/* Done with index truncation, release index tree locks,
subsequent work relates to table level metadata change */
dict_table_x_unlock_indexes
(
table
);
new_id
=
dict_hdr_get_new_id
(
DICT_HDR_TABLE_ID
);
info
=
pars_info_create
();
...
...
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