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.
This commit is contained in:
parent
e2939795b1
commit
ab4bc84420
@ -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. */
|
||||
|
@ -494,10 +494,6 @@ dict_mem_create_temporary_tablename(
|
||||
const char* dbtab,
|
||||
table_id_t id);
|
||||
|
||||
/** Initialize dict memory variables */
|
||||
void
|
||||
dict_mem_init(void);
|
||||
|
||||
/** SQL identifier name wrapper for pretty-printing */
|
||||
class id_name_t
|
||||
{
|
||||
|
@ -1071,8 +1071,6 @@ srv_init()
|
||||
trx_i_s_cache_init(trx_i_s_cache);
|
||||
|
||||
ut_crc32_init();
|
||||
|
||||
dict_mem_init();
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
|
Loading…
x
Reference in New Issue
Block a user