Domanda

i have an InnoDB table containing around 5 million entries. yesterday i tried to create a FULLTEXT index on one of its columns, but unfortunately the connection was interrupted few minutes into the process and so no index was actually created.

the problem is, when i'm trying to create the above index again via this command:

CREATE FULLTEXT INDEX TEXT_FULL ON MY_BIG_TABLE(TEXT_COLUMN);

it gives me the following error:

ERROR 1050 (42S01): Table 'my_db/#sql-ib131' already exists

at first i thought it's just a temporary table named "#sql-ib131" which MySql created in order to complete my previous indexing request, and so i tried to remove it using:

drop table `#sql-ib131`;

but MySql returns the following:

ERROR 1051 (42S02): Unknown table 'my_db.#sql-ib131'

(i also tried dropping "sql-ib131" and "my_db/#sql-ib131" but no luck.

Note: when i run:

SHOW INDEX FROM MY_BIG_TABLE;

no FULLTEXT index is mentioned in the output.

How can i overcome this behaviour and create the desired index?

Thanks, Chikko.

È stato utile?

Soluzione

It appears that when you interrupted attempt to create an index, InnoDB didn't get to fully clean up. Therefore it has an entry in the data dictionary for a table that doesn't physically exist on disk.

This is also reported here: http://bugs.mysql.com/bug.php?id=71819

InnoDB maintains metadata about tables in an internal data dictionary in memory. This stores information about each InnoDB table that has previously been used. The data dictionary in memory is destroyed if you shut down mysqld, and repopulated as you use tables after you restart mysqld.

Temporary tables created by InnoDB (indicated by the name patterned after #sql-ibXXX) are created physically but immediately unlinked.

But if something happens, for instance your connection aborts suddenly, InnoDB may fail to clean up properly.

You should be able to clear the data dictionary by restarting mysqld.


Another case where this weird paradox can happen is with a VIEW, since a view is not a table, but view names conflict with table names.

mysql> CREATE VIEW test.V AS SELECT * FROM test.Foo;

mysql> DROP TABLE test.V;
ERROR 1051 (42S02): Unknown table 'test.V'

mysql> CREATE TABLE test.V (i INT);
ERROR 1050 (42S01): Table 'V' already exists

But this is not your case, since you are clearly getting the error on a temp table created by InnoDB implicitly during an ALTER TABLE to create the index.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top