Bug #75869 InnoDB: Put FTS auxiliary tables into the same general tablespace as the primary
Submitted: 12 Feb 2015 7:12 Modified: 9 Apr 2015 16:31
Reporter: Kevin Lewis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.7 OS:Any
Assigned to: CPU Architecture:Any

[12 Feb 2015 7:12] Kevin Lewis
Description:
If an FTS primary table is assigned to a general tablespace, FTS auxiliary tables should also be created in the same tablespace.

This should work even if the primary table is compressed unless there is a good reason to never compress FTS auxiliary tables.

How to repeat:

mysql> CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) ENGINE = InnoDB TABLESPACE=s1;
Query OK, 0 rows affected (2 min 45.08 sec)

mysql> SELECT * FROM information_schema.INNODB_SYS_TABLES where name like 'test%';
+----------+----------------------------------------------------+------+--------+-------+-------------+------------+---------------+------------+
| TABLE_ID | NAME                                               | FLAG | N_COLS | SPACE | FILE_FORMAT | ROW_FORMAT | ZIP_PAGE_SIZE | SPACE_TYPE |
+----------+----------------------------------------------------+------+--------+-------+-------------+------------+---------------+------------+
|      147 | test/FTS_000000000000008d_00000000000000cf_INDEX_1 |    1 |      8 |     0 | Antelope    | Compact    |             0 | System     |
|      148 | test/FTS_000000000000008d_00000000000000cf_INDEX_2 |    1 |      8 |     0 | Antelope    | Compact    |             0 | System     |
|      149 | test/FTS_000000000000008d_00000000000000cf_INDEX_3 |    1 |      8 |     0 | Antelope    | Compact    |             0 | System     |
|      150 | test/FTS_000000000000008d_00000000000000cf_INDEX_4 |    1 |      8 |     0 | Antelope    | Compact    |             0 | System     |
|      151 | test/FTS_000000000000008d_00000000000000cf_INDEX_5 |    1 |      8 |     0 | Antelope    | Compact    |             0 | System     |
|      152 | test/FTS_000000000000008d_00000000000000cf_INDEX_6 |    1 |      8 |     0 | Antelope    | Compact    |             0 | System     |
|      144 | test/FTS_000000000000008d_BEING_DELETED            |    1 |      4 |    89 | Antelope    | Compact    |             0 | Single     |
|      145 | test/FTS_000000000000008d_BEING_DELETED_CACHE      |    1 |      4 |    90 | Antelope    | Compact    |             0 | Single     |
|      146 | test/FTS_000000000000008d_CONFIG                   |    1 |      5 |    91 | Antelope    | Compact    |             0 | Single     |
|      142 | test/FTS_000000000000008d_DELETED                  |    1 |      4 |    87 | Antelope    | Compact    |             0 | Single     |
|      143 | test/FTS_000000000000008d_DELETED_CACHE            |    1 |      4 |    88 | Antelope    | Compact    |             0 | Single     |
|      141 | test/t1                                            |  129 |      6 |    76 | Antelope    | Compact    |             0 | General    |
+----------+----------------------------------------------------+------+--------+-------+-------------+------------+---------------+------------+
12 rows in set (0.01 sec)

Suggested fix:
FTS auxiliary index tables are created in ts_create_one_index_table() which does not apply the HAS_SHARED_SPACE flag in its call to dict_mem_table_create(). When it does this, care should be taken so that this code will work with a compressed FTS primary table.

FTS auxiliary common tables use the internal SQL parser which does not support the tablespace phrase.  There is a plan to bypass and decommision the InnoDB internal SQL parser in the future. So the proper way to get the FTS common table tablespace aware is to make them use row_create_table_for_mysql() in similare way as the FTS index tables are created..
[9 Apr 2015 16:31] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.8, 5.8.0 releases, and here's the changelog entry:

The following changes were implemented for full-text index auxiliary
tables: 

If the primary table is assigned to a general
tablespace, full-text auxiliary tables are created in the same general
tablespace. 

Full-text auxiliary tables are created with
the same row format as the primary table. 

If the primary table was created in a location outside of the data directory
using the "DATA DIRECTORY" clause, full-text auxiliary tables are created
in the same location.