summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-01-17 11:37:49 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-01-18 08:42:57 +0200
commit7cf97ed4ee93f7df6d021ad54b9f09964a943c82 (patch)
tree2ee7f00f5d2ec3b207cfa9d0a7ce60c940153bf9 /storage
parent494e4b99a4a6c2f933c7e663cbb6ad5b17e8f84a (diff)
downloadmariadb-git-7cf97ed4ee93f7df6d021ad54b9f09964a943c82.tar.gz
MDEV-11816 Disallow CREATE TEMPORARY TABLE…ROW_FORMAT=COMPRESSED
MySQL 5.7 allows temporary tables to be created in ROW_FORMAT=COMPRESSED. The usefulness of this is questionable. WL#7899 in MySQL 8.0.0 prevents the creation of such compressed tables, so that all InnoDB temporary tables will be located inside the predefined InnoDB temporary tablespace. Pick up and adjust some tests from MySQL 5.7 and 8.0. dict_tf_to_fsp_flags(): Remove the parameter is_temp. fsp_flags_init(): Remove the parameter is_temporary. row_mysql_drop_temp_tables(): Remove. There cannot be any temporary tables in InnoDB. (This never removed #sql* tables in the datadir which were created by DDL.) dict_table_t::dir_path_of_temp_table: Remove. create_table_info_t::m_temp_path: Remove. create_table_info_t::create_options_are_invalid(): Do not allow ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE for temporary tables. create_table_info_t::innobase_table_flags(): Do not unnecessarily prevent CREATE TEMPORARY TABLE with SPATIAL INDEX. (MySQL 5.7 does allow this.) fil_space_belongs_in_lru(): The only FIL_TYPE_TEMPORARY tablespace is never subjected to closing least-recently-used files.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/btr/btr0btr.cc3
-rw-r--r--storage/innobase/btr/btr0cur.cc23
-rw-r--r--storage/innobase/dict/dict0crea.cc17
-rw-r--r--storage/innobase/dict/dict0dict.cc18
-rw-r--r--storage/innobase/dict/dict0load.cc17
-rw-r--r--storage/innobase/fil/fil0fil.cc40
-rw-r--r--storage/innobase/fsp/fsp0file.cc5
-rw-r--r--storage/innobase/handler/ha_innodb.cc117
-rw-r--r--storage/innobase/handler/ha_innodb.h10
-rw-r--r--storage/innobase/handler/ha_innopart.cc4
-rw-r--r--storage/innobase/handler/handler0alter.cc1
-rw-r--r--storage/innobase/include/dict0dict.h5
-rw-r--r--storage/innobase/include/dict0mem.h6
-rw-r--r--storage/innobase/include/fil0fil.h8
-rw-r--r--storage/innobase/include/fsp0fsp.h5
-rw-r--r--storage/innobase/include/fsp0fsp.ic7
-rw-r--r--storage/innobase/include/row0mysql.h5
-rw-r--r--storage/innobase/log/log0recv.cc2
-rw-r--r--storage/innobase/page/page0page.cc1
-rw-r--r--storage/innobase/page/page0zip.cc6
-rw-r--r--storage/innobase/row/row0import.cc2
-rw-r--r--storage/innobase/row/row0mysql.cc137
-rw-r--r--storage/innobase/row/row0trunc.cc7
-rw-r--r--storage/innobase/srv/srv0start.cc2
24 files changed, 123 insertions, 325 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index f150a98e6ef..4bebb9ee7dd 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -335,8 +335,7 @@ btr_root_adjust_on_import(
} else {
/* Check that the table flags and the tablespace
flags match. */
- ulint flags = dict_tf_to_fsp_flags(
- table->flags, false);
+ ulint flags = dict_tf_to_fsp_flags(table->flags);
ulint fsp_flags = fil_space_get_flags(table->space);
err = flags == fsp_flags
? DB_SUCCESS : DB_CORRUPTION;
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 87d88cea820..4d0499418a2 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -3048,12 +3048,12 @@ fail_err:
if (*rec) {
} else if (page_size.is_compressed()) {
+ ut_ad(!dict_table_is_temporary(index->table));
/* Reset the IBUF_BITMAP_FREE bits, because
page_cur_tuple_insert() will have attempted page
reorganize before failing. */
if (leaf
- && !dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)) {
+ && !dict_index_is_clust(index)) {
ibuf_reset_free_bits(block);
}
@@ -3649,6 +3649,8 @@ btr_cur_update_in_place(
/* Check that enough space is available on the compressed page. */
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
+
if (!btr_cur_update_alloc_zip(
page_zip, btr_cur_get_page_cur(cursor),
index, offsets, rec_offs_size(offsets),
@@ -3725,9 +3727,9 @@ func_exit:
if (page_zip
&& !(flags & BTR_KEEP_IBUF_BITMAP)
&& !dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)
&& page_is_leaf(buf_block_get_frame(block))) {
/* Update the free bits in the insert buffer. */
+ ut_ad(!dict_table_is_temporary(index->table));
ibuf_update_free_bits_zip(block, mtr);
}
@@ -3876,6 +3878,8 @@ any_extern:
#endif /* UNIV_ZIP_DEBUG */
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
+
if (page_zip_rec_needs_ext(new_rec_size, page_is_comp(page),
dict_index_get_n_fields(index),
dict_table_page_size(index->table))) {
@@ -3994,12 +3998,12 @@ any_extern:
func_exit:
if (!(flags & BTR_KEEP_IBUF_BITMAP)
- && !dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)) {
+ && !dict_index_is_clust(index)) {
/* Update the free bits in the insert buffer. */
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
ibuf_update_free_bits_zip(block, mtr);
- } else {
+ } else if (!dict_table_is_temporary(index->table)) {
ibuf_update_free_bits_low(block, max_ins_size, mtr);
}
}
@@ -4123,6 +4127,7 @@ btr_cur_pessimistic_update(
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
+ ut_ad(!page_zip || !dict_table_is_temporary(index->table));
/* The insert buffer tree should never be updated in place. */
ut_ad(!dict_index_is_ibuf(index));
ut_ad(trx_id > 0
@@ -4153,8 +4158,8 @@ btr_cur_pessimistic_update(
if (page_zip
&& optim_err != DB_ZIP_OVERFLOW
&& !dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)
&& page_is_leaf(page)) {
+ ut_ad(!dict_table_is_temporary(index->table));
ibuf_update_free_bits_zip(block, mtr);
}
@@ -4327,14 +4332,14 @@ btr_cur_pessimistic_update(
page_cursor->rec, index, *offsets);
}
} else if (!dict_index_is_clust(index)
- && !dict_table_is_temporary(index->table)
&& page_is_leaf(page)) {
/* Update the free bits in the insert buffer.
This is the same block which was skipped by
BTR_KEEP_IBUF_BITMAP. */
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
ibuf_update_free_bits_zip(block, mtr);
- } else {
+ } else if (!dict_table_is_temporary(index->table)) {
ibuf_update_free_bits_low(block, max_ins_size,
mtr);
}
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 44624f6b654..c5d8e7ee21f 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -404,6 +404,7 @@ dict_build_tablespace_for_table(
DICT_TF2_FTS_AUX_HEX_NAME););
if (needs_file_per_table) {
+ ut_ad(!dict_table_is_temporary(table));
/* This table will need a new tablespace. */
ut_ad(dict_table_get_format(table) <= UNIV_FORMAT_MAX);
@@ -424,21 +425,10 @@ dict_build_tablespace_for_table(
table->space = static_cast<unsigned int>(space);
/* Determine the tablespace flags. */
- bool is_temp = dict_table_is_temporary(table);
bool has_data_dir = DICT_TF_HAS_DATA_DIR(table->flags);
- ulint fsp_flags = dict_tf_to_fsp_flags(table->flags,
- is_temp);
-
- /* Determine the full filepath */
- if (is_temp) {
- /* Temporary table filepath contains a full path
- and a filename without the extension. */
- ut_ad(table->dir_path_of_temp_table);
- filepath = fil_make_filepath(
- table->dir_path_of_temp_table,
- NULL, IBD, false);
+ ulint fsp_flags = dict_tf_to_fsp_flags(table->flags);
- } else if (has_data_dir) {
+ if (has_data_dir) {
ut_ad(table->data_dir_path);
filepath = fil_make_filepath(
table->data_dir_path,
@@ -474,7 +464,6 @@ dict_build_tablespace_for_table(
mtr_start(&mtr);
mtr.set_named_space(table->space);
- dict_disable_redo_if_temporary(table, &mtr);
bool ret = fsp_header_init(table->space,
FIL_IBD_FILE_INITIAL_SIZE,
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 58d5870bf95..3cf236e643b 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1696,25 +1696,17 @@ dict_table_rename_in_cache(
ib::info() << "Delete of " << filepath << " failed.";
}
-
ut_free(filepath);
} else if (dict_table_is_file_per_table(table)) {
- if (table->dir_path_of_temp_table != NULL) {
- ib::error() << "Trying to rename a TEMPORARY TABLE "
- << old_name
- << " ( " << table->dir_path_of_temp_table
- << " )";
- return(DB_ERROR);
- }
-
char* new_path = NULL;
char* old_path = fil_space_get_first_path(table->space);
+ ut_ad(!dict_table_is_temporary(table));
+
if (DICT_TF_HAS_DATA_DIR(table->flags)) {
new_path = os_file_make_new_pathname(
old_path, new_name);
-
err = RemoteDatafile::create_link_file(
new_name, new_path);
@@ -7254,12 +7246,9 @@ Other bits are the same.
dict_table_t::flags | 0 | 1 | 1 | 1
fil_space_t::flags | 0 | 0 | 1 | 1
@param[in] table_flags dict_table_t::flags
-@param[in] is_temp whether the tablespace is temporary
@return tablespace flags (fil_space_t::flags) */
ulint
-dict_tf_to_fsp_flags(
- ulint table_flags,
- bool is_temp)
+dict_tf_to_fsp_flags(ulint table_flags)
{
DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure",
return(ULINT_UNDEFINED););
@@ -7276,7 +7265,6 @@ dict_tf_to_fsp_flags(
ulint fsp_flags = fsp_flags_init(page_size,
has_atomic_blobs,
has_data_dir,
- is_temp,
0,
0,
0);
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index a3da3a755d6..756e1010d66 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -1239,8 +1239,7 @@ dict_check_sys_tables(
char* filepath = dict_get_first_path(space_id);
/* Check that the .ibd file exists. */
- bool is_temp = flags2 & DICT_TF2_TEMPORARY;
- ulint fsp_flags = dict_tf_to_fsp_flags(flags, is_temp);
+ ulint fsp_flags = dict_tf_to_fsp_flags(flags);
validate = true; /* Encryption */
dberr_t err = fil_ibd_open(
@@ -2513,9 +2512,9 @@ dict_get_and_save_data_dir_path(
dict_table_t* table,
bool dict_mutex_own)
{
- bool is_temp = DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY);
+ ut_ad(!dict_table_is_temporary(table));
- if (!is_temp && !table->data_dir_path && table->space) {
+ if (!table->data_dir_path && table->space) {
char* path = fil_space_get_first_path(table->space);
if (!dict_mutex_own) {
@@ -2610,6 +2609,8 @@ dict_load_tablespace(
mem_heap_t* heap,
dict_err_ignore_t ignore_err)
{
+ ut_ad(!dict_table_is_temporary(table));
+
/* The system tablespace is always available. */
if (is_system_tablespace(table->space)) {
return;
@@ -2622,12 +2623,6 @@ dict_load_tablespace(
return;
}
- if (dict_table_is_temporary(table)) {
- /* Do not bother to retry opening temporary tables. */
- table->ibd_file_missing = TRUE;
- return;
- }
-
char* space_name = table->name.m_name;
/* The tablespace may already be open. */
@@ -2662,7 +2657,7 @@ dict_load_tablespace(
/* Try to open the tablespace. We set the 2nd param (fix_dict) to
false because we do not have an x-lock on dict_operation_lock */
- ulint fsp_flags = dict_tf_to_fsp_flags(table->flags, false);
+ ulint fsp_flags = dict_tf_to_fsp_flags(table->flags);
dberr_t err = fil_ibd_open(
true, false, FIL_TYPE_TABLESPACE, table->space,
fsp_flags, space_name, filepath, table);
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 331fc34e603..bfae83af3df 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -215,12 +215,13 @@ fil_space_belongs_in_lru(
const fil_space_t* space) /*!< in: file space */
{
switch (space->purpose) {
+ case FIL_TYPE_TEMPORARY:
case FIL_TYPE_LOG:
return(false);
case FIL_TYPE_TABLESPACE:
- case FIL_TYPE_TEMPORARY:
- case FIL_TYPE_IMPORT:
return(fil_is_user_tablespace_id(space->id));
+ case FIL_TYPE_IMPORT:
+ return(true);
}
ut_ad(0);
@@ -3711,7 +3712,7 @@ func_exit:
return(success);
}
-/** Create a new General or Single-Table tablespace
+/** Create a tablespace file.
@param[in] space_id Tablespace ID
@param[in] name Tablespace name in dbname/tablename format.
@param[in] path Path and filename of the datafile to create.
@@ -3736,7 +3737,6 @@ fil_ibd_create(
byte* buf2;
byte* page;
bool success;
- bool is_temp = FSP_FLAGS_GET_TEMPORARY(flags);
bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags);
fil_space_t* space = NULL;
fil_space_crypt_t *crypt_data = NULL;
@@ -3926,21 +3926,16 @@ fil_ibd_create(
crypt_data = fil_space_create_crypt_data(mode, key_id);
}
- space = fil_space_create(name, space_id, flags, is_temp
- ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE,
+ space = fil_space_create(name, space_id, flags, FIL_TYPE_TABLESPACE,
crypt_data, true);
if (!fil_node_create_low(path, size, space, false, true)) {
-
if (crypt_data) {
free(crypt_data);
}
err = DB_ERROR;
- goto error_exit_1;
- }
-
- if (!is_temp) {
+ } else {
mtr_t mtr;
const fil_node_t* file = UT_LIST_GET_FIRST(space->chain);
@@ -3950,20 +3945,14 @@ fil_ibd_create(
NULL, space->flags, &mtr);
fil_name_write(space, 0, file, &mtr);
mtr_commit(&mtr);
- }
-
- err = DB_SUCCESS;
-
- /* Error code is set. Cleanup the various variables used.
- These labels reflect the order in which variables are assigned or
- actions are done. */
-error_exit_1:
- if (err != DB_SUCCESS && has_data_dir) {
- RemoteDatafile::delete_link_file(name);
+ err = DB_SUCCESS;
}
os_file_close(file);
if (err != DB_SUCCESS) {
+ if (has_data_dir) {
+ RemoteDatafile::delete_link_file(name);
+ }
os_file_delete(innodb_data_file_key, path);
}
@@ -4596,10 +4585,8 @@ fil_ibd_load(
ut_ad(space == NULL);
- bool is_temp = FSP_FLAGS_GET_TEMPORARY(file.flags());
space = fil_space_create(
- file.name(), space_id, file.flags(),
- is_temp ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE,
+ file.name(), space_id, file.flags(), FIL_TYPE_TABLESPACE,
file.get_crypt_info(), false);
if (space == NULL) {
@@ -4668,10 +4655,7 @@ fil_report_missing_tablespace(
<< " in the InnoDB data dictionary has tablespace id "
<< space_id << ","
" but tablespace with that id or name does not exist. Have"
- " you deleted or moved .ibd files? This may also be a table"
- " created with CREATE TEMPORARY TABLE whose .ibd and .frm"
- " files MySQL automatically removed, but the table still"
- " exists in the InnoDB internal data dictionary.";
+ " you deleted or moved .ibd files?";
}
/** Returns true if a matching tablespace exists in the InnoDB tablespace
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index 00b5c37cec4..afd4ba9dddc 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -550,7 +550,10 @@ Datafile::validate_first_page(lsn_t* flush_lsn,
free_first_page();
return(DB_ERROR);
-
+ } else if (!fsp_flags_is_valid(m_flags)
+ || FSP_FLAGS_GET_TEMPORARY(m_flags)) {
+ /* Tablespace flags must be valid. */
+ error_txt = "Tablespace flags are invalid";
} else if (page_get_page_no(m_first_page) != 0) {
/* First page must be number 0 */
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 56b1f968244..db1d90c06fe 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4098,7 +4098,7 @@ innobase_init(
/* Create the filespace flags. */
fsp_flags = fsp_flags_init(
- univ_page_size, false, false, false, false, 0, 0);
+ univ_page_size, false, false, false, 0, 0);
srv_sys_space.set_flags(fsp_flags);
srv_sys_space.set_name("innodb_system");
@@ -4124,7 +4124,7 @@ innobase_init(
/* Create the filespace flags with the temp flag set. */
fsp_flags = fsp_flags_init(
- univ_page_size, false, false, true, false, 0, 0);
+ univ_page_size, false, false, false, 0, 0);
srv_tmp_space.set_flags(fsp_flags);
if (!srv_tmp_space.parse_params(innobase_temp_data_file_path, false)) {
@@ -11755,11 +11755,6 @@ create_table_info_t::create_table_def()
? doc_id_col : n_cols - num_v;
}
- if (strlen(m_temp_path) != 0) {
- table->dir_path_of_temp_table =
- mem_heap_strdup(table->heap, m_temp_path);
- }
-
if (DICT_TF_HAS_DATA_DIR(m_flags)) {
ut_a(strlen(m_remote_path));
@@ -12271,9 +12266,10 @@ create_table_info_t::create_options_are_invalid()
const char* ret = NULL;
enum row_type row_format = m_create_info->row_type;
+ const bool is_temp
+ = m_create_info->options & HA_LEX_CREATE_TMP_TABLE;
ut_ad(m_thd != NULL);
- ut_ad(m_create_info != NULL);
/* If innodb_strict_mode is not set don't do any more validation. */
if (!THDVAR(m_thd, strict_mode)) {
@@ -12282,6 +12278,12 @@ create_table_info_t::create_options_are_invalid()
/* Check if a non-zero KEY_BLOCK_SIZE was specified. */
if (has_key_block_size) {
+ if (is_temp) {
+ my_error(ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE,
+ MYF(0));
+ return("KEY_BLOCK_SIZE");
+ }
+
switch (m_create_info->key_block_size) {
ulint kbs_max;
case 1:
@@ -12341,6 +12343,11 @@ create_table_info_t::create_options_are_invalid()
other incompatibilities. */
switch (row_format) {
case ROW_TYPE_COMPRESSED:
+ if (is_temp) {
+ my_error(ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE,
+ MYF(0));
+ return("ROW_FORMAT");
+ }
if (!m_allow_file_per_table) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
@@ -12361,7 +12368,7 @@ create_table_info_t::create_options_are_invalid()
}
break;
case ROW_TYPE_DYNAMIC:
- if (!m_allow_file_per_table) {
+ if (!m_allow_file_per_table && !is_temp) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
@@ -12370,7 +12377,7 @@ create_table_info_t::create_options_are_invalid()
get_row_format_name(row_format));
ret = "ROW_FORMAT";
}
- if (srv_file_format < UNIV_FORMAT_B) {
+ if (!is_temp && srv_file_format < UNIV_FORMAT_B) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
@@ -12595,6 +12602,10 @@ ha_innobase::update_create_info(
create_info->auto_increment_value = stats.auto_increment_value;
}
+ if (dict_table_is_temporary(m_prebuilt->table)) {
+ return;
+ }
+
/* Update the DATA DIRECTORY name from SYS_DATAFILES. */
dict_get_and_save_data_dir_path(m_prebuilt->table, false);
@@ -12619,8 +12630,7 @@ innobase_fts_load_stopword(
THDVAR(thd, ft_enable_stopword), FALSE));
}
-/** Parse the table name into normal name and either temp path or remote path
-if needed.
+/** Parse the table name into normal name and remote path if needed.
@param[in] name Table name (db/table or full path).
@return 0 if successful, otherwise, error number */
int
@@ -12653,17 +12663,8 @@ create_table_info_t::parse_table_name(
}
#endif
- m_temp_path[0] = '\0';
m_remote_path[0] = '\0';
- /* A full path is provided by the server for TEMPORARY tables not
- targeted for a tablespace or when DATA DIRECTORY is given.
- So these two are not compatible. Likewise, DATA DIRECTORY is not
- compatible with a TABLESPACE assignment. */
- if ((m_create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
- strncpy(m_temp_path, name, FN_REFLEN - 1);
- }
-
/* Make sure DATA DIRECTORY is compatible with other options
and set the remote path. In the case of either;
CREATE TEMPORARY TABLE ... DATA DIRECTORY={path} ... ;
@@ -12703,11 +12704,14 @@ create_table_info_t::innobase_table_flags()
DBUG_ENTER("innobase_table_flags");
const char* fts_doc_id_index_bad = NULL;
- bool zip_allowed = true;
ulint zip_ssize = 0;
enum row_type row_type;
rec_format_t innodb_row_format =
get_row_format(innodb_default_row_format);
+ const bool is_temp
+ = m_create_info->options & HA_LEX_CREATE_TMP_TABLE;
+ bool zip_allowed
+ = !is_temp;
const ulint zip_ssize_max =
ut_min(static_cast<ulint>(UNIV_PAGE_SSIZE_MAX),
@@ -12735,8 +12739,7 @@ create_table_info_t::innobase_table_flags()
/* We don't support FTS indexes in temporary
tables. */
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) {
-
+ if (is_temp) {
my_error(ER_INNODB_NO_FT_TEMP_TABLE, MYF(0));
DBUG_RETURN(false);
}
@@ -12744,12 +12747,6 @@ create_table_info_t::innobase_table_flags()
if (fts_doc_id_index_bad) {
goto index_bad;
}
- } else if (key->flags & HA_SPATIAL) {
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE
- && !m_use_file_per_table) {
- my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0));
- DBUG_RETURN(false);
- }
}
if (innobase_strcasecmp(key->name, FTS_DOC_ID_INDEX_NAME)) {
@@ -12789,7 +12786,14 @@ index_bad:
}
/* Make sure compressed row format is allowed. */
- if (!m_allow_file_per_table) {
+ if (is_temp) {
+ push_warning(
+ m_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: KEY_BLOCK_SIZE is ignored"
+ " for TEMPORARY TABLE.");
+ zip_allowed = false;
+ } else if (!m_allow_file_per_table) {
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
@@ -12859,9 +12863,14 @@ index_bad:
innodb_row_format = REC_FORMAT_COMPACT;
break;
case ROW_TYPE_COMPRESSED:
- /* ROW_FORMAT=COMPRESSED requires file_per_table and
- file_format=Barracuda unless there is a target tablespace. */
- if (!m_allow_file_per_table) {
+ if (is_temp) {
+ push_warning_printf(
+ m_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ "InnoDB: ROW_FORMAT=%s is ignored for"
+ " TEMPORARY TABLE.",
+ get_row_format_name(row_type));
+ } else if (!m_allow_file_per_table) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
@@ -12874,20 +12883,9 @@ index_bad:
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=COMPRESSED requires"
" innodb_file_format > Antelope.");
-
} else {
- switch(row_type) {
- case ROW_TYPE_COMPRESSED:
- innodb_row_format = REC_FORMAT_COMPRESSED;
- break;
- case ROW_TYPE_DYNAMIC:
- innodb_row_format = REC_FORMAT_DYNAMIC;
- break;
- default:
- /* Not possible, avoid compiler warning */
- break;
- }
- break; /* Correct row_format */
+ innodb_row_format = REC_FORMAT_COMPRESSED;
+ break;
}
zip_allowed = false;
/* fall through to set row_type = DYNAMIC */
@@ -12915,13 +12913,18 @@ index_bad:
zip_allowed = false;
}
+ ut_ad(!is_temp || !zip_allowed);
+ ut_ad(!is_temp || innodb_row_format != REC_FORMAT_COMPRESSED);
+
/* Set the table flags */
if (!zip_allowed) {
zip_ssize = 0;
}
- if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) {
+ if (is_temp) {
m_flags2 |= DICT_TF2_TEMPORARY;
+ } else if (m_use_file_per_table) {
+ m_flags2 |= DICT_TF2_USE_FILE_PER_TABLE;
}
/* Set the table flags */
@@ -12932,10 +12935,6 @@ index_bad:
default_compression_level : options->page_compression_level,
0);
- if (m_use_file_per_table) {
- m_flags2 |= DICT_TF2_USE_FILE_PER_TABLE;
- }
-
/* Set the flags2 when create table or alter tables */
m_flags2 |= DICT_TF2_FTS_AUX_HEX_NAME;
DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name",
@@ -13125,24 +13124,16 @@ create_table_info_t::set_tablespace_type(
m_innodb_file_per_table
|| table_being_altered_is_file_per_table;
- /* All noncompresed temporary tables will be put into the
- system temporary tablespace. */
- bool is_noncompressed_temporary =
- m_create_info->options & HA_LEX_CREATE_TMP_TABLE
- && !(m_create_info->row_type == ROW_TYPE_COMPRESSED
- || m_create_info->key_block_size > 0);
-
/* Ignore the current innodb-file-per-table setting if we are
- creating a temporary, non-compressed table. */
+ creating a temporary table. */
m_use_file_per_table =
m_allow_file_per_table
- && !is_noncompressed_temporary;
+ && !(m_create_info->options & HA_LEX_CREATE_TMP_TABLE);
/* DATA DIRECTORY must have m_use_file_per_table but cannot be
used with TEMPORARY tables. */
m_use_data_dir =
m_use_file_per_table
- && !(m_create_info->options & HA_LEX_CREATE_TMP_TABLE)
&& (m_create_info->data_file_name != NULL)
&& (m_create_info->data_file_name[0] != '\0');
}
@@ -13570,7 +13561,6 @@ ha_innobase::create(
{
int error;
char norm_name[FN_REFLEN]; /* {database}/{tablename} */
- char temp_path[FN_REFLEN]; /* Absolute path of temp frm */
char remote_path[FN_REFLEN]; /* Absolute path of table */
trx_t* trx;
DBUG_ENTER("ha_innobase::create");
@@ -13579,7 +13569,6 @@ ha_innobase::create(
form,
create_info,
norm_name,
- temp_path,
remote_path);
/* Initialize the object. */
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 066eff12ca9..d11d5913f34 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -688,13 +688,11 @@ public:
TABLE* form,
HA_CREATE_INFO* create_info,
char* table_name,
- char* temp_path,
char* remote_path)
:m_thd(thd),
m_form(form),
m_create_info(create_info),
m_table_name(table_name),
- m_temp_path(temp_path),
m_remote_path(remote_path),
m_innodb_file_per_table(srv_file_per_table)
{}
@@ -804,12 +802,6 @@ private:
/** Table name */
char* m_table_name;
- /** If this is a table explicitly created by the user with the
- TEMPORARY keyword, then this parameter is the dir path where the
- table should be placed if we create an .ibd file for it
- (no .ibd extension in the path, though).
- Otherwise this is a zero length-string */
- char* m_temp_path;
/** Remote path (DATA DIRECTORY) or zero length-string */
char* m_remote_path;
diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc
index 80f3b410ee7..6cdbd226b24 100644
--- a/storage/innobase/handler/ha_innopart.cc
+++ b/storage/innobase/handler/ha_innopart.cc
@@ -2607,8 +2607,6 @@ ha_innopart::create(
int error;
/** {database}/{tablename} */
char table_name[FN_REFLEN];
- /** absolute path of temp frm */
- char temp_path[FN_REFLEN];
/** absolute path of table */
char remote_path[FN_REFLEN];
char partition_name[FN_REFLEN];
@@ -2623,7 +2621,6 @@ ha_innopart::create(
form,
create_info,
table_name,
- temp_path,
remote_path);
DBUG_ENTER("ha_innopart::create");
@@ -2649,7 +2646,6 @@ ha_innopart::create(
if (error != 0) {
DBUG_RETURN(error);
}
- ut_ad(temp_path[0] == '\0');
strcpy(partition_name, table_name);
partition_name_start = partition_name + strlen(partition_name);
table_name_len = strlen(table_name);
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 8ba9f6cb175..341c341f112 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -5588,7 +5588,6 @@ ha_innobase::prepare_inplace_alter_table(
altered_table,
ha_alter_info->create_info,
NULL,
- NULL,
NULL);
info.set_tablespace_type(indexed_table->space != TRX_SYS_SPACE);
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index a7fe80e447d..349b105be6a 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -1036,12 +1036,9 @@ dict_table_t::flags | 0 | 1 | 1 | 1
fil_space_t::flags | 0 | 0 | 1 | 1
==================================================================
@param[in] table_flags dict_table_t::flags
-@param[in] is_temp whether the tablespace is temporary
@return tablespace flags (fil_space_t::flags) */
ulint
-dict_tf_to_fsp_flags(
- ulint table_flags,
- bool is_temp)
+dict_tf_to_fsp_flags(ulint table_flags)
MY_ATTRIBUTE((const));
/** Extract the page size from table flags.
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 6717e7085c2..ccfc46f7941 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -1375,12 +1375,6 @@ struct dict_table_t {
/** Table name. */
table_name_t name;
- /** NULL or the directory path where a TEMPORARY table that was
- explicitly created by a user should be placed if innodb_file_per_table
- is defined in my.cnf. In Unix this is usually "/tmp/...",
- in Windows "temp\...". */
- const char* dir_path_of_temp_table;
-
/** NULL or the directory path specified by DATA DIRECTORY. */
char* data_dir_path;
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index eebe21d85bf..3d786764148 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -956,13 +956,15 @@ fil_make_filepath(
ib_extention suffix,
bool strip_name);
-/** Creates a new General or Single-Table tablespace
+/** Create a tablespace file.
@param[in] space_id Tablespace ID
@param[in] name Tablespace name in dbname/tablename format.
@param[in] path Path and filename of the datafile to create.
@param[in] flags Tablespace flags
@param[in] size Initial size of the tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE
+@param[in] mode MariaDB encryption mode
+@param[in] key_id MariaDB encryption key_id
@return DB_SUCCESS or error code */
dberr_t
fil_ibd_create(
@@ -971,8 +973,8 @@ fil_ibd_create(
const char* path,
ulint flags,
ulint size,
- fil_encryption_t mode, /*!< in: encryption mode */
- ulint key_id) /*!< in: encryption key_id */
+ fil_encryption_t mode,
+ ulint key_id)
MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//**
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 129842982a3..878929c085c 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -648,7 +648,9 @@ fsp_flags_is_compressed(
@param[in] page_size page sizes in bytes and compression flag.
@param[in] atomic_blobs Used by Dynammic and Compressed.
@param[in] has_data_dir This tablespace is in a remote location.
-@param[in] is_temporary This tablespace is temporary.
+@param[in] page_compressed Table uses page compression
+@param[in] page_compression_level Page compression level
+@param[in] not_used For future
@return tablespace flags after initialization */
UNIV_INLINE
ulint
@@ -656,7 +658,6 @@ fsp_flags_init(
const page_size_t& page_size,
bool atomic_blobs,
bool has_data_dir,
- bool is_temporary,
bool page_compression,
ulint page_compression_level,
ulint not_used);
diff --git a/storage/innobase/include/fsp0fsp.ic b/storage/innobase/include/fsp0fsp.ic
index 9ff2dab75d4..6d0d6f05a9f 100644
--- a/storage/innobase/include/fsp0fsp.ic
+++ b/storage/innobase/include/fsp0fsp.ic
@@ -145,7 +145,6 @@ fsp_flags_set_page_size(
@param[in] page_size page sizes in bytes and compression flag.
@param[in] atomic_blobs Used by Dynammic and Compressed.
@param[in] has_data_dir This tablespace is in a remote location.
-@param[in] is_temporary This tablespace is temporary.
@param[in] page_compressed Table uses page compression
@param[in] page_compression_level Page compression level
@param[in] not_used For future
@@ -156,7 +155,6 @@ fsp_flags_init(
const page_size_t& page_size,
bool atomic_blobs,
bool has_data_dir,
- bool is_temporary,
bool page_compression,
ulint page_compression_level,
ulint not_used)
@@ -181,11 +179,6 @@ fsp_flags_init(
flags |= FSP_FLAGS_MASK_DATA_DIR;
}
- if (is_temporary) {
- ut_ad(!has_data_dir);
- flags |= FSP_FLAGS_MASK_TEMPORARY;
- }
-
/* In addition, tablespace flags also contain if the page
compression is used for this table. */
if (page_compression) {
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 67482db160a..4c272d96a39 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -481,11 +481,6 @@ row_drop_table_for_mysql(
bool nonatomic = true);
/*!< in: whether it is permitted
to release and reacquire dict_operation_lock */
-/*********************************************************************//**
-Drop all temporary tables during crash recovery. */
-void
-row_mysql_drop_temp_tables(void);
-/*============================*/
/*********************************************************************//**
Discards the tablespace of a table which stored in an .ibd file. Discarding
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index e2f5265261b..e5aab543f5d 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -3535,8 +3535,6 @@ recv_recovery_rollback_active(void)
/* Drop partially created indexes. */
row_merge_drop_temp_indexes();
- /* Drop temporary tables. */
- row_mysql_drop_temp_tables();
/* Drop any auxiliary tables that were not dropped when the
parent table was dropped. This can happen if the parent table
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 704ed55f2b3..e2d2dd40fd8 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -550,6 +550,7 @@ page_create_empty(
}
if (page_zip) {
+ ut_ad(!dict_table_is_temporary(index->table));
page_create_zip(block, index,
page_header_get_field(page, PAGE_LEVEL),
max_trx_id, NULL, mtr);
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index c47a1905b4b..35ef24c16a6 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -4688,6 +4688,7 @@ page_zip_reorganize(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_is_comp(page));
ut_ad(!dict_index_is_ibuf(index));
+ ut_ad(!dict_table_is_temporary(index->table));
/* Note that page_zip_validate(page_zip, page, index) may fail here. */
UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
@@ -4719,7 +4720,6 @@ page_zip_reorganize(
temp_page + (PAGE_HEADER + PAGE_MAX_TRX_ID), 8);
/* PAGE_MAX_TRX_ID must be set on secondary index leaf pages. */
ut_ad(dict_index_is_clust(index) || !page_is_leaf(temp_page)
- || dict_table_is_temporary(index->table)
|| page_get_max_trx_id(page) != 0);
/* PAGE_MAX_TRX_ID must be zero on non-leaf pages other than
clustered index root pages. */
@@ -4764,6 +4764,7 @@ page_zip_copy_recs(
ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains_page(mtr, src, MTR_MEMO_PAGE_X_FIX));
ut_ad(!dict_index_is_ibuf(index));
+ ut_ad(!dict_table_is_temporary(index->table));
#ifdef UNIV_ZIP_DEBUG
/* The B-tree operations that call this function may set
FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag
@@ -4807,8 +4808,7 @@ page_zip_copy_recs(
} else {
/* The PAGE_MAX_TRX_ID must be nonzero on leaf pages
of secondary indexes, and 0 on others. */
- ut_ad(dict_table_is_temporary(index->table)
- || !page_is_leaf(src) == !page_get_max_trx_id(src));
+ ut_ad(!page_is_leaf(src) == !page_get_max_trx_id(src));
}
/* Copy all fields of src_zip to page_zip, except the pointer
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 88a4ce8b7d7..554455509a7 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -3604,7 +3604,7 @@ row_import_for_mysql(
we will not be writing any redo log for it before we have invoked
fil_space_set_imported() to declare it a persistent tablespace. */
- ulint fsp_flags = dict_tf_to_fsp_flags(table->flags, false);
+ ulint fsp_flags = dict_tf_to_fsp_flags(table->flags);
err = fil_ibd_open(
true, true, FIL_TYPE_IMPORT, table->space,
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 0bc4fe4def9..187dd06acf1 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -3546,36 +3546,25 @@ This deletes the fil_space_t if found and the file on disk.
@param[in] space_id Tablespace ID
@param[in] tablename Table name, same as the tablespace name
@param[in] filepath File path of tablespace to delete
-@param[in] is_temp Is this a temporary table/tablespace
-@param[in] trx Transaction handle
@return error code or DB_SUCCESS */
UNIV_INLINE
dberr_t
row_drop_single_table_tablespace(
ulint space_id,
const char* tablename,
- const char* filepath,
- bool is_temp,
- trx_t* trx)
+ const char* filepath)
{
dberr_t err = DB_SUCCESS;
- /* This might be a temporary single-table tablespace if the table
- is compressed and temporary. If so, don't spam the log when we
- delete one of these or if we can't find the tablespace. */
- bool print_msg = !is_temp;
-
/* If the tablespace is not in the cache, just delete the file. */
if (!fil_space_for_table_exists_in_mem(
- space_id, tablename, print_msg, false, NULL, 0, NULL)) {
+ space_id, tablename, true, false, NULL, 0, NULL)) {
/* Force a delete of any discarded or temporary files. */
fil_delete_file(filepath);
- if (print_msg) {
- ib::info() << "Removed datafile " << filepath
- << " for table " << tablename;
- }
+ ib::info() << "Removed datafile " << filepath
+ << " for table " << tablename;
} else if (fil_delete_tablespace(space_id, BUF_REMOVE_FLUSH_NO_WRITE)
!= DB_SUCCESS) {
@@ -4042,12 +4031,12 @@ row_drop_table_for_mysql(
/* remove the index object associated. */
dict_drop_index_tree_in_mem(index, *page_no++);
}
- err = DB_SUCCESS;
+ err = row_drop_table_from_cache(tablename, table, trx);
+ goto funct_exit;
}
switch (err) {
ulint space_id;
- bool is_temp;
bool ibd_file_missing;
bool is_discarded;
@@ -4055,18 +4044,7 @@ row_drop_table_for_mysql(
space_id = table->space;
ibd_file_missing = table->ibd_file_missing;
is_discarded = dict_table_is_discarded(table);
- is_temp = dict_table_is_temporary(table);
-
- /* If there is a temp path then the temp flag is set.
- However, during recovery, we might have a temp flag but
- not know the temp path */
- ut_a(table->dir_path_of_temp_table == NULL || is_temp);
-
- /* We do not allow temporary tables with a remote path. */
- ut_a(!(is_temp && DICT_TF_HAS_DATA_DIR(table->flags)));
-
- /* Make sure the data_dir_path is set if needed. */
- dict_get_and_save_data_dir_path(table, true);
+ ut_ad(!dict_table_is_temporary(table));
err = row_drop_ancillary_fts_tables(table, trx);
if (err != DB_SUCCESS) {
@@ -4076,14 +4054,11 @@ row_drop_table_for_mysql(
/* Determine the tablespace filename before we drop
dict_table_t. Free this memory before returning. */
if (DICT_TF_HAS_DATA_DIR(table->flags)) {
+ dict_get_and_save_data_dir_path(table, true);
ut_a(table->data_dir_path);
filepath = fil_make_filepath(
table->data_dir_path,
table->name.m_name, IBD, true);
- } else if (table->dir_path_of_temp_table) {
- filepath = fil_make_filepath(
- table->dir_path_of_temp_table,
- NULL, IBD, false);
} else {
filepath = fil_make_filepath(
NULL, table->name.m_name, IBD, false);
@@ -4104,8 +4079,7 @@ row_drop_table_for_mysql(
/* We can now drop the single-table tablespace. */
err = row_drop_single_table_tablespace(
- space_id, tablename, filepath,
- is_temp, trx);
+ space_id, tablename, filepath);
break;
case DB_OUT_OF_FILE_SPACE:
@@ -4187,99 +4161,6 @@ funct_exit:
DBUG_RETURN(err);
}
-/*********************************************************************//**
-Drop all temporary tables during crash recovery. */
-void
-row_mysql_drop_temp_tables(void)
-/*============================*/
-{
- trx_t* trx;
- btr_pcur_t pcur;
- mtr_t mtr;
- mem_heap_t* heap;
-
- trx = trx_allocate_for_background();
- trx->op_info = "dropping temporary tables";
- row_mysql_lock_data_dictionary(trx);
-
- heap = mem_heap_create(200);
-
- mtr_start(&mtr);
-
- btr_pcur_open_at_index_side(
- true,
- dict_table_get_first_index(dict_sys->sys_tables),
- BTR_SEARCH_LEAF, &pcur, true, 0, &mtr);
-
- for (;;) {
- const rec_t* rec;
- const byte* field;
- ulint len;
- const char* table_name;
- dict_table_t* table;
-
- btr_pcur_move_to_next_user_rec(&pcur, &mtr);
-
- if (!btr_pcur_is_on_user_rec(&pcur)) {
- break;
- }
-
- /* The high order bit of N_COLS is set unless
- ROW_FORMAT=REDUNDANT. */
- rec = btr_pcur_get_rec(&pcur);
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__NAME, &len);
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__N_COLS, &len);
- if (len != 4
- || !(mach_read_from_4(field) & DICT_N_COLS_COMPACT)) {
- continue;
- }
-
- /* Older versions of InnoDB, which only supported tables
- in ROW_FORMAT=REDUNDANT could write garbage to
- SYS_TABLES.MIX_LEN, where we now store the is_temp flag.
- Above, we assumed is_temp=0 if ROW_FORMAT=REDUNDANT. */
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__MIX_LEN, &len);
- if (len != 4
- || !(mach_read_from_4(field) & DICT_TF2_TEMPORARY)) {
- continue;
- }
-
- /* This is a temporary table. */
- field = rec_get_nth_field_old(
- rec, DICT_FLD__SYS_TABLES__NAME, &len);
- if (len == UNIV_SQL_NULL || len == 0) {
- /* Corrupted SYS_TABLES.NAME */
- continue;
- }
-
- table_name = mem_heap_strdupl(heap, (const char*) field, len);
-
- btr_pcur_store_position(&pcur, &mtr);
- btr_pcur_commit_specify_mtr(&pcur, &mtr);
-
- table = dict_load_table(table_name, true,
- DICT_ERR_IGNORE_NONE);
-
- if (table) {
- row_drop_table_for_mysql(table_name, trx, FALSE, FALSE);
- trx_commit_for_mysql(trx);
- }
-
- mtr_start(&mtr);
- btr_pcur_restore_position(BTR_SEARCH_LEAF,
- &pcur, &mtr);
- }
-
- btr_pcur_close(&pcur);
- mtr_commit(&mtr);
- mem_heap_free(heap);
- row_mysql_unlock_data_dictionary(trx);
- trx_free_for_background(trx);
-}
-
/*******************************************************************//**
Drop all foreign keys in a database, see Bug#18942.
Called at the end of row_drop_database_for_mysql().
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index b372da4b939..094c0b45e6d 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -1993,9 +1993,9 @@ row_truncate_table_for_mysql(
return(row_truncate_complete(
table, trx, fsp_flags, logger, err));
}
-
} else {
/* For temporary tables we don't have entries in SYSTEM TABLES*/
+ ut_ad(fsp_is_system_temporary(table->space));
for (dict_index_t* index = UT_LIST_GET_FIRST(table->indexes);
index != NULL;
index = UT_LIST_GET_NEXT(indexes, index)) {
@@ -2018,10 +2018,7 @@ row_truncate_table_for_mysql(
}
}
- if (is_file_per_table
- && !dict_table_is_temporary(table)
- && fsp_flags != ULINT_UNDEFINED) {
-
+ if (is_file_per_table && fsp_flags != ULINT_UNDEFINED) {
fil_reinit_space_header(
table->space,
table->indexes.count + FIL_IBD_FILE_INITIAL_SIZE + 1);
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index ddc766accd4..d0b7ddc0449 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -692,7 +692,7 @@ srv_undo_tablespace_open(
/* Set the compressed page size to 0 (non-compressed) */
flags = fsp_flags_init(
- univ_page_size, false, false, false, false, 0, 0);
+ univ_page_size, false, false, false, 0, 0);
space = fil_space_create(
undo_name, space_id, flags, FIL_TYPE_TABLESPACE, NULL, true);