0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

mysql.general_log2がINNODB_SYS_TABLESに存在するがTABLESに存在しない

Last updated at Posted at 2024-11-12

TL;DR

RDSであれば、Troubleshootingをやめて、新規クラスターを作成しデータ移行するか、AWS Supportに連絡かをしましょう。

症状

MySQL8 にアップグレードする時、Precheckで下記のエラーが検知。文面通り、mysql.general_log2というTableがないのに、INNODB_SYS_TABLESに存在している。

        {
            "id": "schemaInconsistencyCheck",
            "title": "Schema inconsistencies resulting from file removal or corruption",
            "status": "OK",
            "description": "Error: 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",
            "detectedProblems": [
                {
                    "level": "Error",
                    "dbObject": "mysql.general_log2",
                    "description": "present in INFORMATION_SCHEMA's INNODB_SYS_TABLES table but missing from TABLES table"
                }
            ]
        }

クエリで取得した結果。

mysql> select * from information_schema.innodb_sys_tables where NAME = 'mysql/general_log2';
+----------+--------------------+------+--------+--------+-------------+------------+---------------+------------+
| TABLE_ID | NAME               | FLAG | N_COLS | SPACE  | FILE_FORMAT | ROW_FORMAT | ZIP_PAGE_SIZE | SPACE_TYPE |
+----------+--------------------+------+--------+--------+-------------+------------+---------------+------------+
|   124561 | mysql/general_log2 |    1 |      9 | 124547 | Antelope    | Compact    |             0 | Single     |
+----------+--------------------+------+--------+--------+-------------+------------+---------------+------------+
1 row in set (0.04 sec)

mysql> select table_name from information_schema.tables where TABLE_SCHEMA ='mysql' and TABLE_NAME = 'general_log2' ;
Empty set (0.02 sec)

原因

RDSのせいだと思われる。

ログをRotateする時に上手くいかず、ゴミが残ってた。

普通はどう対処する?

マスターユーザーで残っているファイルを削除。


mysql> select * from information_schema.innodb_sys_datafiles where path like "./mysql/general_log2.%";
+--------+--------------------------+
| SPACE  | PATH                     |
+--------+--------------------------+
| 124547 | ./mysql/general_log2.ibd |
+--------+--------------------------+
1 row in set (0.05 sec)

RDSであれば打つ手がない

なぜなら、Master User(root)でもmysql Tableを変更する権限もないし、MySQLのファイルシステムにアクセスできないから。

じゃどうすればいい

  • データベースをDumpして新規クラスターに移行
  • AWS Supportに連絡して対応してもらう
    • 解決できる保証がないけど
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?