present in INFORMATION_SCHEMA’s INNODB_SYS_TABLES table but missing from TABLES table

AWS

概要

RDSをmysql 8.0にアップグレードしようとしたらエラー

PrePatchCompatibility.logに以下のようなエラーが出ました。(xxxxxxxはデータベース名)

17) Schema inconsistencies resulting from file removal or corruption
	Following tables show signs that either table datadir directory or frm file was removed/corrupted. Please check server logs, examine datadir to detect the issue and fix it before upgrade
	xxxxxxx - present in INFORMATION_SCHEMA's INNODB_SYS_TABLES table but missing from TABLES table

スキーマ変更中にinterruptしてしまったときにtemporary tableが残る様子。

要らないので消してしまいます。

解決法

https://serverfault.com/a/1002705/556236 を参考に。

mysql> use xxxxxxx;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> drop table `#mysql50##sql-105e_bcd3`;
Query OK, 0 rows affected (0.41 sec)

#mysql50# の部分は、ファイルシステムを参照する特殊な表記。sql-105e_bcd3の部分は以下のクエリーを実行して出力された値です。

select * from information_schema.innodb_sys_tables where name like '%#%';

無くなったかを確認

mysql> select * from information_schema.innodb_sys_tables where name like '%#%';
Empty set (0.01 sec)

余談

  • アップグレード自体は15分ぐらい。DBの容量は約100GB。
mysql> show variables where Variable_name = 'Version';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| version       | 8.0.17 |
+---------------+--------+
1 row in set (0.01 sec)

コメント