概要
Mysql5.7時代に使っていたAuroraのCloudformationを適用してみたら以下のエラー。
"Invalid / Unmodifiable / Unsupported DB Parameter: innodb_file_format"
Mysql8.0になって非推奨になった部分ですね。
あまりネットにないエラーメッセージだったのでこちらで紹介します。
原因と解決策
MySQL 5.7からMySQL 8.0への移行に伴い、以下の機能が廃止されています。
- InnoDB File Format: MySQL 8.0ではBarracudaフォーマットのみをサポート(設定不要)
- Query Cache: パフォーマンス上の問題から完全に削除
これらを修正することで、RDS Aurora MySQL 8.0のDBクラスターが正常に作成できるようになりました。
公式にも以下の通り記載がありました。
query_cache_limit: Do not cache results that are bigger than this. Removed in MySQL 8.0.3.
query_cache_min_res_unit: Minimal size of unit in which space for results is allocated (last unit is trimmed after writing all result data). Removed in MySQL 8.0.3.
https://dev.mysql.com/doc/refman/8.0/en/added-deprecated-removed.html
innodb_file_format: Format for new InnoDB tables. Removed in MySQL 8.0.0.
https://dev.mysql.com/doc/refman/8.0/en/added-deprecated-removed.html
サンプルコード
ということで、以下before/afterです。
afterの方でエラーは解消されました。
ご参考までに。
BEFORE
ClusterParameterGroup:
Type: AWS::RDS::DBClusterParameterGroup
Properties:
Family: "aurora-mysql5.7"
Description: "aurora-mysql5.7"
Parameters:
time_zone: "Asia/Tokyo"
character_set_client: utf8
character_set_database: utf8
character_set_server: utf8
character_set_results: utf8
skip-character-set-client-handshake: true
binlog_format: mixed
sql_mode: NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
innodb_file_per_table: true
innodb_file_format: Barracuda
query_cache_limit: 1048576
query_cache_min_res_unit: 4096
group_concat_max_len: 100000
AFTER
ClusterParameterGroup:
Type: AWS::RDS::DBClusterParameterGroup
Properties:
Family: "aurora-mysql8.0"
Description: "aurora-mysql8.0"
Parameters:
time_zone: "Asia/Tokyo"
# MySQL 8.0ではutf8mb4が推奨(utf8mb3は非推奨)
character_set_client: utf8mb4
character_set_database: utf8mb4
character_set_server: utf8mb4
character_set_results: utf8mb4
skip-character-set-client-handshake: true
# MySQL 8.0ではROWがデフォルト推奨(レプリケーション安全性向上)
binlog_format: ROW
sql_mode: NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
group_concat_max_len: 100000
参考
utfについては以下参照。
utf8mb3 文字セットは非推奨であり、将来の MySQL リリースで削除される予定です。 かわりに utf8mb4 を使用してください。 utf8 は現在 utf8mb3 のエイリアスですが、ある時点では utf8 が utf8mb4 への参照になることが予想されます。 utf8 の意味があいまいにならないように、utf8 ではなく文字セット参照に utf8mb4 を明示的に指定することを検討してください。
https://dev.mysql.com/doc/refman/8.0/ja/charset-unicode-utf8.html
binlog_formatについては以下参照。
(こちらは8.0.34で非推奨、将来的にはRemoveされるらしいです...)
