diff options
author | Jimmy Yang <jimmy.yang@oracle.com> | 2010-10-25 00:02:03 -0700 |
---|---|---|
committer | Jimmy Yang <jimmy.yang@oracle.com> | 2010-10-25 00:02:03 -0700 |
commit | d96b0e5801d2c4e5212e5e384a08a8eaae8f2e29 (patch) | |
tree | f97d68273d581e3cefcac4b88f359e20119376d8 /storage/innobase/row/row0mysql.c | |
parent | 1291c004775458f2f35e24730c9694f99b5b54d7 (diff) | |
parent | 112684b0ba31dbdc3f3b914a7f738793d28431fd (diff) | |
download | mariadb-git-d96b0e5801d2c4e5212e5e384a08a8eaae8f2e29.tar.gz |
merge from mysql-5.1-innodb to mysql-5.5-innodb.
Diffstat (limited to 'storage/innobase/row/row0mysql.c')
-rw-r--r-- | storage/innobase/row/row0mysql.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 71ef587b141..2479628562d 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -2813,15 +2813,6 @@ 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); - if (table->space && !table->dir_path_of_temp_table) { /* Discard and create the single-table tablespace. */ ulint space = table->space; @@ -2834,6 +2825,11 @@ row_truncate_table_for_mysql( dict_hdr_get_new_id(NULL, NULL, &space); + /* Lock all index trees for this table. We must + do so after dict_hdr_get_new_id() to preserve + the latch order */ + dict_table_x_lock_indexes(table); + if (space == ULINT_UNDEFINED || fil_create_new_single_table_tablespace( space, table->name, FALSE, flags, @@ -2867,6 +2863,15 @@ row_truncate_table_for_mysql( FIL_IBD_FILE_INITIAL_SIZE, &mtr); mtr_commit(&mtr); } + } else { + /* 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 */ |