Commit 1cfcd4f2 authored by marko's avatar marko

branches/zip: Create special single-table tablespace file names for

temporary tablespaces in fast index creation.  The tablespaces must
reside in the same directory as the persistent tablespaces, so that
they can be renamed without copying.  Namespace collisions are avoided
by replacing the ".ibd" file name suffix with ".ib1" or ".ib2".

fil_make_ibd_name(): Treat names starting with TEMP_TABLE_PREFIX
specially.  Document the dependence on
innobase_create_temporary_tablename().
parent 0954bbed
......@@ -2363,6 +2363,16 @@ fil_make_ibd_name(
if (is_temp) {
memcpy(filename, name, namelen);
memcpy(filename + namelen, ".ibd", sizeof ".ibd");
} else if (name[0] == TEMP_TABLE_PREFIX) {
/* Create a temporary tablespace for fast index creation.
See innobase_create_temporary_tablename(). */
memcpy(filename, fil_path_to_mysql_datadir, dirlen);
filename[dirlen] = '/';
memcpy(filename + dirlen + 1, name + 2, namelen - 2);
memcpy(filename + dirlen + namelen - 1, ".ibd", sizeof ".ibd");
/* Replace the 'd' in ".ibd" with the tablename prefix. */
filename[dirlen + namelen + 2] = name[1];
} else {
memcpy(filename, fil_path_to_mysql_datadir, dirlen);
filename[dirlen] = '/';
......
......@@ -8106,6 +8106,8 @@ innobase_create_temporary_tablename(
len = strlen(table_name) + 3;
name = (char*) mem_heap_alloc_noninline(heap, len);
/* The prefix must be 2 bytes, and the second byte must not be 'd'.
See fil_make_ibd_name(). */
name[0] = TEMP_TABLE_PREFIX;
name[1] = id;
memcpy(name + 2, table_name, len - 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment