|
|
@ -2766,6 +2766,15 @@ row_truncate_table_for_mysql( |
|
|
|
|
|
|
|
|
trx->table_id = table->id; |
|
|
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) { |
|
|
if (table->space && !table->dir_path_of_temp_table) { |
|
|
/* Discard and create the single-table tablespace. */ |
|
|
/* Discard and create the single-table tablespace. */ |
|
|
ulint space = table->space; |
|
|
ulint space = table->space; |
|
|
@ -2782,6 +2791,7 @@ row_truncate_table_for_mysql( |
|
|
|| fil_create_new_single_table_tablespace( |
|
|
|| fil_create_new_single_table_tablespace( |
|
|
space, table->name, FALSE, flags, |
|
|
space, table->name, FALSE, flags, |
|
|
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { |
|
|
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { |
|
|
|
|
|
dict_table_x_unlock_indexes(table); |
|
|
ut_print_timestamp(stderr); |
|
|
ut_print_timestamp(stderr); |
|
|
fprintf(stderr, |
|
|
fprintf(stderr, |
|
|
" InnoDB: TRUNCATE TABLE %s failed to" |
|
|
" InnoDB: TRUNCATE TABLE %s failed to" |
|
|
@ -2885,6 +2895,10 @@ next_rec: |
|
|
|
|
|
|
|
|
mem_heap_free(heap); |
|
|
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); |
|
|
|
|
|
|
|
|
dict_hdr_get_new_id(&new_id, NULL, NULL); |
|
|
dict_hdr_get_new_id(&new_id, NULL, NULL); |
|
|
|
|
|
|
|
|
info = pars_info_create(); |
|
|
info = pars_info_create(); |
|
|
|