diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-06-15 12:41:02 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-06-15 12:41:02 +0300 |
commit | 58f87a41bd8de7370cc05c41977fadc685826c9e (patch) | |
tree | 05efedf2233c3f0a14d126ef9ffcaeb24f375712 | |
parent | 88b961816e90c57b0f6f166e6c7650a1ae540751 (diff) | |
download | mariadb-git-58f87a41bd8de7370cc05c41977fadc685826c9e.tar.gz |
Remove some fields from dict_table_t
dict_table_t::thd: Remove. This was only used by btr_root_block_get()
for reporting decryption failures, and it was only assigned by
ha_innobase::open(), and never cleared. This could mean that if a
connection is closed, the pointer would become stale, and the server
could crash while trying to report the error. It could also mean
that an error is being reported to the wrong client. It is better
to use current_thd in this case, even though it could mean that if
the code is invoked from an InnoDB background operation, there would
be no connection to which to send the error message.
Remove dict_table_t::crypt_data and dict_table_t::page_0_read.
These fields were never read.
fil_open_single_table_tablespace(): Remove the parameter "table".
-rw-r--r-- | storage/innobase/btr/btr0btr.cc | 3 | ||||
-rw-r--r-- | storage/innobase/dict/dict0load.cc | 4 | ||||
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 18 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 2 | ||||
-rw-r--r-- | storage/innobase/include/dict0mem.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/fil0fil.h | 3 | ||||
-rw-r--r-- | storage/innobase/row/row0import.cc | 2 | ||||
-rw-r--r-- | storage/innobase/row/row0mysql.cc | 12 | ||||
-rw-r--r-- | storage/xtradb/btr/btr0btr.cc | 3 | ||||
-rw-r--r-- | storage/xtradb/dict/dict0load.cc | 4 | ||||
-rw-r--r-- | storage/xtradb/fil/fil0fil.cc | 18 | ||||
-rw-r--r-- | storage/xtradb/handler/ha_innodb.cc | 2 | ||||
-rw-r--r-- | storage/xtradb/include/dict0mem.h | 4 | ||||
-rw-r--r-- | storage/xtradb/include/fil0fil.h | 3 | ||||
-rw-r--r-- | storage/xtradb/row/row0import.cc | 2 | ||||
-rw-r--r-- | storage/xtradb/row/row0mysql.cc | 12 |
16 files changed, 14 insertions, 82 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index b7afcf12b39..c519baef58c 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -740,7 +740,8 @@ btr_root_block_get( if (index && index->table) { index->table->file_unreadable = true; - ib_push_warning(index->table->thd, DB_DECRYPTION_FAILED, + ib_push_warning( + static_cast<THD*>(NULL), DB_DECRYPTION_FAILED, "Table %s in tablespace %lu is encrypted but encryption service or" " used key_id is not available. " " Can't continue reading table.", diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index a1d18690476..4a2b6d43bbd 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1173,7 +1173,7 @@ loop: dberr_t err = fil_open_single_table_tablespace( read_page_0, srv_read_only_mode ? false : true, space_id, dict_tf_to_fsp_flags(flags), - name, filepath, NULL); + name, filepath); if (err != DB_SUCCESS) { ib_logf(IB_LOG_LEVEL_ERROR, @@ -2415,7 +2415,7 @@ err_exit: err = fil_open_single_table_tablespace( true, false, table->space, dict_tf_to_fsp_flags(table->flags), - name, filepath, table); + name, filepath); if (err != DB_SUCCESS) { /* We failed to find a sensible diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index ffb01312fdb..d78a8b20f33 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -4036,8 +4036,7 @@ fil_open_single_table_tablespace( ulint flags, /*!< in: expected FSP_SPACE_FLAGS */ const char* tablename, /*!< in: table name in the databasename/tablename format */ - const char* path_in, /*!< in: tablespace filepath */ - dict_table_t* table) /*!< in: table */ + const char* path_in) /*!< in: table */ { dberr_t err = DB_SUCCESS; bool dict_filepath_same_as_default = false; @@ -4147,11 +4146,6 @@ fil_open_single_table_tablespace( #endif /* UNIV_LOG_ARCHIVE */ NULL, &def.crypt_data); - if (table) { - table->crypt_data = def.crypt_data; - table->page_0_read = true; - } - def.valid = !def.check_msg && def.id == id && fsp_flags_match(flags, def.flags); @@ -4174,11 +4168,6 @@ fil_open_single_table_tablespace( #endif /* UNIV_LOG_ARCHIVE */ NULL, &remote.crypt_data); - if (table) { - table->crypt_data = remote.crypt_data; - table->page_0_read = true; - } - /* Validate this single-table-tablespace with SYS_TABLES. */ remote.valid = !remote.check_msg && remote.id == id && fsp_flags_match(flags, remote.flags); @@ -4203,11 +4192,6 @@ fil_open_single_table_tablespace( #endif /* UNIV_LOG_ARCHIVE */ NULL, &dict.crypt_data); - if (table) { - table->crypt_data = dict.crypt_data; - table->page_0_read = true; - } - /* Validate this single-table-tablespace with SYS_TABLES. */ dict.valid = !dict.check_msg && dict.id == id && fsp_flags_match(flags, dict.flags); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index bd89744c1f0..6c43e637318 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5860,8 +5860,6 @@ table_opened: innobase_copy_frm_flags_from_table_share(ib_table, table->s); - ib_table->thd = (void*)thd; - /* No point to init any statistics if tablespace is still encrypted. */ if (ib_table->is_readable()) { dict_stats_init(ib_table); diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index cea75d6ab47..1c0f4d73006 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1032,10 +1032,6 @@ struct dict_table_t{ table_id_t id; /*!< id of the table */ mem_heap_t* heap; /*!< memory heap */ char* name; /*!< table name */ - void* thd; /*!< thd */ - bool page_0_read; /*!< true if page 0 has - been already read */ - fil_space_crypt_t *crypt_data; /*!< crypt data if present */ const char* dir_path_of_temp_table;/*!< NULL or the directory path where a TEMPORARY table that was explicitly created by a user should be placed if diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index e16c7cb102e..8033d0cc839 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1045,8 +1045,7 @@ fil_open_single_table_tablespace( ulint flags, /*!< in: expected FSP_SPACE_FLAGS */ const char* tablename, /*!< in: table name in the databasename/tablename format */ - const char* filepath, /*!< in: tablespace filepath */ - dict_table_t* table) /*!< in: table */ + const char* filepath) /*!< in: tablespace filepath */ __attribute__((nonnull(5), warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index f0db79be17e..43830725978 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -3617,7 +3617,7 @@ row_import_for_mysql( err = fil_open_single_table_tablespace( true, true, table->space, dict_tf_to_fsp_flags(table->flags), - table->name, filepath, table); + table->name, filepath); DBUG_EXECUTE_IF("ib_import_open_tablespace_failure", err = DB_TABLESPACE_NOT_FOUND;); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 82938995e93..1d64d66cd49 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -4242,18 +4242,6 @@ row_drop_table_for_mysql( rw_lock_x_unlock(dict_index_get_lock(index)); } - /* If table has not yet have crypt_data, try to read it to - make freeing the table easier. */ - if (!table->crypt_data) { - - if (fil_space_t* space = fil_space_acquire_silent(table->space)) { - /* We use crypt data in dict_table_t in ha_innodb.cc - to push warnings to user thread. */ - table->crypt_data = space->crypt_data; - fil_space_release(space); - } - } - /* We use the private SQL parser of Innobase to generate the query graphs needed in deleting the dictionary data from system tables in Innobase. Deleting a row from SYS_INDEXES table also diff --git a/storage/xtradb/btr/btr0btr.cc b/storage/xtradb/btr/btr0btr.cc index e66599e206d..85a083aaee0 100644 --- a/storage/xtradb/btr/btr0btr.cc +++ b/storage/xtradb/btr/btr0btr.cc @@ -745,7 +745,8 @@ btr_root_block_get( if (index && index->table) { index->table->file_unreadable = true; - ib_push_warning(index->table->thd, DB_DECRYPTION_FAILED, + ib_push_warning( + static_cast<THD*>(NULL), DB_DECRYPTION_FAILED, "Table %s in tablespace %lu is encrypted but encryption service or" " used key_id is not available. " " Can't continue reading table.", diff --git a/storage/xtradb/dict/dict0load.cc b/storage/xtradb/dict/dict0load.cc index dc3f9c85bba..6171bbd80d0 100644 --- a/storage/xtradb/dict/dict0load.cc +++ b/storage/xtradb/dict/dict0load.cc @@ -1193,7 +1193,7 @@ loop: dberr_t err = fil_open_single_table_tablespace( read_page_0, srv_read_only_mode ? false : true, space_id, dict_tf_to_fsp_flags(flags), - name, filepath, NULL); + name, filepath); if (err != DB_SUCCESS) { ib_logf(IB_LOG_LEVEL_ERROR, @@ -2437,7 +2437,7 @@ err_exit: err = fil_open_single_table_tablespace( true, false, table->space, dict_tf_to_fsp_flags(table->flags), - name, filepath, table); + name, filepath); if (err != DB_SUCCESS) { /* We failed to find a sensible diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 12048bc479f..fdd09a6034e 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -4229,8 +4229,7 @@ fil_open_single_table_tablespace( ulint flags, /*!< in: expected FSP_SPACE_FLAGS */ const char* tablename, /*!< in: table name in the databasename/tablename format */ - const char* path_in, /*!< in: tablespace filepath */ - dict_table_t* table) /*!< in: table */ + const char* path_in) /*!< in: table */ { dberr_t err = DB_SUCCESS; bool dict_filepath_same_as_default = false; @@ -4339,11 +4338,6 @@ fil_open_single_table_tablespace( def.file, false, &def.flags, &def.id, NULL, &def.crypt_data); - if (table) { - table->crypt_data = def.crypt_data; - table->page_0_read = true; - } - def.valid = !def.check_msg && def.id == id && fsp_flags_match(flags, def.flags); @@ -4363,11 +4357,6 @@ fil_open_single_table_tablespace( remote.file, false, &remote.flags, &remote.id, NULL, &remote.crypt_data); - if (table) { - table->crypt_data = remote.crypt_data; - table->page_0_read = true; - } - /* Validate this single-table-tablespace with SYS_TABLES. */ remote.valid = !remote.check_msg && remote.id == id && fsp_flags_match(flags, remote.flags); @@ -4389,11 +4378,6 @@ fil_open_single_table_tablespace( dict.file, false, &dict.flags, &dict.id, NULL, &dict.crypt_data); - if (table) { - table->crypt_data = dict.crypt_data; - table->page_0_read = true; - } - /* Validate this single-table-tablespace with SYS_TABLES. */ dict.valid = !dict.check_msg && dict.id == id && fsp_flags_match(flags, dict.flags); diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index ee1e306b441..eb02ed6699e 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -6429,8 +6429,6 @@ table_opened: innobase_copy_frm_flags_from_table_share(ib_table, table->s); - ib_table->thd = (void*)thd; - /* No point to init any statistics if tablespace is still encrypted. */ if (ib_table->is_readable()) { dict_stats_init(ib_table); diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index a32581a0e90..2a4422fc18b 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -1048,10 +1048,6 @@ struct dict_table_t{ table_id_t id; /*!< id of the table */ mem_heap_t* heap; /*!< memory heap */ char* name; /*!< table name */ - void* thd; /*!< thd */ - bool page_0_read; /*!< true if page 0 has - been already read */ - fil_space_crypt_t *crypt_data; /*!< crypt data if present */ const char* dir_path_of_temp_table;/*!< NULL or the directory path where a TEMPORARY table that was explicitly created by a user should be placed if diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index a09833c3a73..6eab5db6883 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -1043,8 +1043,7 @@ fil_open_single_table_tablespace( ulint flags, /*!< in: expected FSP_SPACE_FLAGS */ const char* tablename, /*!< in: table name in the databasename/tablename format */ - const char* filepath, /*!< in: tablespace filepath */ - dict_table_t* table) /*!< in: table */ + const char* filepath) /*!< in: tablespace filepath */ __attribute__((nonnull(5), warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc index 2f7aece665a..86b2d782b7b 100644 --- a/storage/xtradb/row/row0import.cc +++ b/storage/xtradb/row/row0import.cc @@ -3618,7 +3618,7 @@ row_import_for_mysql( err = fil_open_single_table_tablespace( true, true, table->space, dict_tf_to_fsp_flags(table->flags), - table->name, filepath, table); + table->name, filepath); DBUG_EXECUTE_IF("ib_import_open_tablespace_failure", err = DB_TABLESPACE_NOT_FOUND;); diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index 59568f5c91b..0079fc79a0e 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -4272,18 +4272,6 @@ row_drop_table_for_mysql( rw_lock_x_unlock(dict_index_get_lock(index)); } - /* If table has not yet have crypt_data, try to read it to - make freeing the table easier. */ - if (!table->crypt_data) { - - if (fil_space_t* space = fil_space_acquire_silent(table->space)) { - /* We use crypt data in dict_table_t in ha_innodb.cc - to push warnings to user thread. */ - table->crypt_data = space->crypt_data; - fil_space_release(space); - } - } - /* We use the private SQL parser of Innobase to generate the query graphs needed in deleting the dictionary data from system tables in Innobase. Deleting a row from SYS_INDEXES table also |