diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-27 18:19:41 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-27 18:35:08 +0200 |
commit | ab4bc8442094a2be8cdb74bfcddfccede81ac03d (patch) | |
tree | ac2e828d3298531a983049031e76d3207a333df8 /storage/innobase/dict/dict0mem.cc | |
parent | e2939795b140beb894e31d06986677b425a87f86 (diff) | |
download | mariadb-git-ab4bc8442094a2be8cdb74bfcddfccede81ac03d.tar.gz |
Follow-up to MDEV-14585: Remove dict_temp_file_num
Now that InnoDB startup drops tables whose name starts with #sql,
the table ID alone should be enough to create a unique table name.
dict_temp_file_num, dict_mem_init(): Remove.
dict_mem_create_temporary_tablename(): Use a combination of
"#sql-ib" and the ID of the table that is being rebuilt
in TRUNCATE TABLE, or discarded in the commit of table-rebuilding
ALTER TABLE...ALGORITHM=INPLACE, or deferred to the DROP queue.
Thanks to Sergey Vojtovich for pointing this out.
Diffstat (limited to 'storage/innobase/dict/dict0mem.cc')
-rw-r--r-- | storage/innobase/dict/dict0mem.cc | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 3056f73f0cb..077fab8f131 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -34,7 +34,6 @@ Created 1/8/1996 Heikki Tuuri #include "mach0data.h" #include "dict0dict.h" #include "fts0priv.h" -#include "ut0crc32.h" #include "lock0lock.h" #include "sync0sync.h" #include "row0row.h" @@ -82,10 +81,6 @@ const char table_name_t::part_suffix[4] = "#P#"; #endif -/** An interger randomly initialized at startup used to make a temporary -table name as unuique as possible. */ -static ib_uint32_t dict_temp_file_num; - /** Display an identifier. @param[in,out] s output stream @param[in] id_name SQL identifier (other than table name) @@ -1105,35 +1100,15 @@ dict_mem_create_temporary_tablename( ut_ad(dbend); size_t dblen = size_t(dbend - dbtab) + 1; - /* Increment a randomly initialized number for each temp file. */ - my_atomic_add32((int32*) &dict_temp_file_num, 1); - - size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20 + 1 + 10); + size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20); name = static_cast<char*>(mem_heap_alloc(heap, size)); memcpy(name, dbtab, dblen); snprintf(name + dblen, size - dblen, - TEMP_FILE_PREFIX_INNODB UINT64PF "-" UINT32PF, - id, dict_temp_file_num); + TEMP_FILE_PREFIX_INNODB UINT64PF, id); return(name); } -/** Initialize dict memory variables */ -void -dict_mem_init(void) -{ - /* Initialize a randomly distributed temporary file number */ - ib_uint32_t now = static_cast<ib_uint32_t>(ut_time()); - - const byte* buf = reinterpret_cast<const byte*>(&now); - - dict_temp_file_num = ut_crc32(buf, sizeof(now)); - - DBUG_PRINT("dict_mem_init", - ("Starting Temporary file number is " UINT32PF, - dict_temp_file_num)); -} - /** Validate the search order in the foreign key set. @param[in] fk_set the foreign key set to be validated @return true if search order is fine in the set, false otherwise. */ |