diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-11 08:16:06 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-11 15:48:43 +0200 |
commit | d6ee28582a177679c79272c6db6a6f204d8fd49f (patch) | |
tree | 2a5aded6dc0793bf3e7dba2eb9c8b990fbfa038f /storage | |
parent | 7b7e5922afa38241e0ed54aad266c54225d3f861 (diff) | |
download | mariadb-git-d6ee28582a177679c79272c6db6a6f204d8fd49f.tar.gz |
Cleanup: Remove dict_space_is_empty(), dict_space_get_id()
As noted in commit 0b66d3f70d365bbb936aae4ca67892c17d68d241,
MariaDB does not support CREATE TABLESPACE for InnoDB.
Hence, some code that was added in
commit fec844aca88e1c6b9c36bb0b811e92d9d023ffb9
and originally in
mysql/mysql-server@c71dd213bd434c0579e454ab8880e6d3756b0fb0
is unused in MariaDB and should be removed.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/dict/dict0dict.cc | 138 | ||||
-rw-r--r-- | storage/innobase/include/dict0dict.h | 24 |
2 files changed, 1 insertions, 161 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index e3ce13b5b27..2124fc05faa 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -6707,144 +6707,6 @@ dict_sys_get_size() return size; } -/** Look for any dictionary objects that are found in the given tablespace. -@param[in] space_id Tablespace ID to search for. -@return true if tablespace is empty. */ -bool -dict_space_is_empty( - ulint space_id) -{ - btr_pcur_t pcur; - const rec_t* rec; - mtr_t mtr; - bool found = false; - - rw_lock_x_lock(&dict_operation_lock); - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - - for (rec = dict_startscan_system(&pcur, &mtr, SYS_TABLES); - rec != NULL; - rec = dict_getnext_system(&pcur, &mtr)) { - const byte* field; - ulint len; - ulint space_id_for_table; - - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_TABLES__SPACE, &len); - ut_ad(len == 4); - space_id_for_table = mach_read_from_4(field); - - if (space_id_for_table == space_id) { - found = true; - } - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(&dict_operation_lock); - - return(!found); -} - -/** Find the space_id for the given name in sys_tablespaces. -@param[in] name Tablespace name to search for. -@return the tablespace ID. */ -ulint -dict_space_get_id( - const char* name) -{ - btr_pcur_t pcur; - const rec_t* rec; - mtr_t mtr; - ulint name_len = strlen(name); - ulint id = ULINT_UNDEFINED; - - rw_lock_x_lock(&dict_operation_lock); - mutex_enter(&dict_sys->mutex); - mtr_start(&mtr); - - for (rec = dict_startscan_system(&pcur, &mtr, SYS_TABLESPACES); - rec != NULL; - rec = dict_getnext_system(&pcur, &mtr)) { - const byte* field; - ulint len; - - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_TABLESPACES__NAME, &len); - ut_ad(len > 0); - ut_ad(len < OS_FILE_MAX_PATH); - - if (len == name_len && ut_memcmp(name, field, len) == 0) { - - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_TABLESPACES__SPACE, &len); - ut_ad(len == 4); - id = mach_read_from_4(field); - - /* This is normally called by dict_getnext_system() - at the end of the index. */ - btr_pcur_close(&pcur); - break; - } - } - - mtr_commit(&mtr); - mutex_exit(&dict_sys->mutex); - rw_lock_x_unlock(&dict_operation_lock); - - return(id); -} - -/** Determine the extent size (in pages) for the given table -@param[in] table the table whose extent size is being - calculated. -@return extent size in pages (256, 128 or 64) */ -ulint -dict_table_extent_size( - const dict_table_t* table) -{ - const ulint mb_1 = 1024 * 1024; - const ulint mb_2 = 2 * mb_1; - const ulint mb_4 = 4 * mb_1; - - page_size_t page_size = dict_table_page_size(table); - ulint pages_in_extent = FSP_EXTENT_SIZE; - - if (page_size.is_compressed()) { - - ulint disk_page_size = page_size.physical(); - - switch (disk_page_size) { - case 1024: - pages_in_extent = mb_1/1024; - break; - case 2048: - pages_in_extent = mb_1/2048; - break; - case 4096: - pages_in_extent = mb_1/4096; - break; - case 8192: - pages_in_extent = mb_1/8192; - break; - case 16384: - pages_in_extent = mb_1/16384; - break; - case 32768: - pages_in_extent = mb_2/32768; - break; - case 65536: - pages_in_extent = mb_4/65536; - break; - default: - ut_ad(0); - } - } - - return(pages_in_extent); -} - size_t dict_table_t::get_overflow_field_local_len() const { diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 7351b5fb682..6cfb92a94d3 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, 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 @@ -989,14 +989,6 @@ dict_tf_get_page_size( ulint flags) MY_ATTRIBUTE((const)); -/** Determine the extent size (in pages) for the given table -@param[in] table the table whose extent size is being - calculated. -@return extent size in pages (256, 128 or 64) */ -ulint -dict_table_extent_size( - const dict_table_t* table); - /** Get the table page size. @param[in] table table @return compressed page size, or 0 if not compressed */ @@ -1905,20 +1897,6 @@ UNIV_INTERN ulint dict_sys_get_size(); -/** Look for any dictionary objects that are found in the given tablespace. -@param[in] space_id Tablespace ID to search for. -@return true if tablespace is empty. */ -bool -dict_space_is_empty( - ulint space_id); - -/** Find the space_id for the given name in sys_tablespaces. -@param[in] name Tablespace name to search for. -@return the tablespace ID. */ -ulint -dict_space_get_id( - const char* name); - /** Free the virtual column template @param[in,out] vc_templ virtual column template */ UNIV_INLINE |