Aurora MySQL バージョン3系でリーダーインスタンスからテーブルが見えなくなるバグの旅路
メディア統括本部 サービスリライアビリティグループ(SRG)の鬼海雄太(@fat47)です。
#SRG(Service Reliability Group)は、主に弊社メディアサービスのインフラ周りを横断的にサポートしており、既存サービスの改善や新規立ち上げ、OSS貢献などを行っているグループです。
本記事は、Aurora MySQLバージョン3でDDL実行中に、リーダーエンドポイントからテーブルが見えなくなるという事象についてまとめている記事になります
なにかの役に立てば幸いです。
DDL実行中にリーダーエンドポイントからテーブルが見えなくなるバグ実は何度も修正され続けているバグ2023-10-25 3.05.0(MySQL MySQL 8.0.32互換)2024-03-15 3.04.2(MySQL MySQL 8.0.28互換)2024-11-18 3.08.0(MySQL 8.0.39互換)2026-02-17 3.12.0(MySQL 8.0.44互換)2026-05-21 Aurora MySQL 8.4.7(MySQL 8.4.7互換)2026-07-30 Aurora MySQL 3.10.5(MySQL 8.0.42互換)Aurora MySQL 3.08(MySQL 8.0.39互換)でバグ解消したパターンAurora MySQL 3.08(MySQL 8.0.39互換)でバグが再現するパターンAurora MySQL 3.12.0(MySQL 8.0.44互換)でもバグは継続Aurora MySQL 8.4.7 (MySQL 8.4.7互換)ではバグ解消Aurora MySQL 3.10.5 (MySQL 8.0.42互換)でもバグ解消終わりに
DDL実行中にリーダーエンドポイントからテーブルが見えなくなるバグ
Aurora MySQL v3になってから発生しているバグで、DDL実行中にリーダーエンドポイントから該当テーブルが見えなくなるというものがありました。
このバグ自体は2024年3月リリースのv3.04.2(MySQL 8.0.28互換)で解消されたのですが、まだバグが再現するシチュエーションがある。
という事を2024年7月に下記ブログ記事でまとめていました。
ブログ内容は、1度目のDDLが完了後、一度もリーダーエンドポイントに該当テーブルへのSELECTがない状態で2度目のDDLを実行すると、DDL実行中にリーダーエンドポイントから該当テーブルが見えなくなる。
というバグが当時最新のv3.07.0(MySQL8.0.36互換)でも再現するというものでした。
実は何度も修正され続けているバグ
実はこのような挙動をしてしまうバグは、Aurora MySQLのリリースで度々修正されています。
2023-10-25 3.05.0(MySQL MySQL 8.0.32互換)
Fixed an issue where the reader instance is unable to open a table, with ERROR 1146. This issue occurs when executing certain types of online Data Definition Language (DDL) while the INPLACE algorithm is being used on the writer instance.
2024-03-15 3.04.2(MySQL MySQL 8.0.28互換)
Fixed an issue where the reader DB instance is unable to open a table, with ERROR 1146. This issue occurs when running certain types of online Data Definition Language (DDL) statements while the INPLACE algorithm is being used on the writer DB instance.
2024-11-18 3.08.0(MySQL 8.0.39互換)
Fixed an issue that, in rare cases, caused either intermittent unavailability of an Aurora read replica or table definition inconsistencies, sometimes with the error Table does not exist, on the replica. This is due to concurrent read queries on the replica and Data Definition Language (DDL) operations on the writer DB instance.
2026-02-17 3.12.0(MySQL 8.0.44互換)
Fixed an issue, which in rare cases, caused intermittent unavailability of an Aurora Read Replica or table definition inconsistencies with error 'Table does not exist' on the replica due to concurrent read queries on the replica and DDL operations on the writer.
2026-05-21 Aurora MySQL 8.4.7(MySQL 8.4.7互換)
Fixed an issue where the reader reports "ERROR 1146" (table not found) during certain online DDL operations on the writer when using INPLACE algorithm. This can occur when the reader has not previously opened the table before the DDL begins. It can also occur when the reader restarts or a new reader is created while the DDL is in progress.
2026-07-30 Aurora MySQL 3.10.5(MySQL 8.0.42互換)
Fixed an issue where the reader reports ERROR 1146 (table not found) during certain online DDL operations on the writer when using the INPLACE algorithm. This can occur when either the reader has not previously opened the table before the DDL begins, or the reader restarts or a new reader is created while the DDL is in progress.
Aurora MySQL 3.08(MySQL 8.0.39互換)でバグ解消したパターン
先程のブログ記事で書いた、v3.07までバグが再現する手順をv3.08で検証してみます。
バージョンの確認
再現用テーブルの作成し、100万件程度のレコードを追加します。
2つのDDLを実行します
2つめのDDL実行中に別ターミナルから、リーダーエンドポイントでSELECTを実行してもエラーになりません。v3.08ではバグが解消されています!
Aurora MySQL 3.08(MySQL 8.0.39互換)でバグが再現するパターン
これにて一件落着!かと思いきや、まだ同様のバグが発生するパターンが存在します。
それは該当テーブルがパーティショニングされている時です。以下が再現手順です。
まずバージョンを確認します。
再現用テーブルを作成します。パーティショニングしています。
ライターエンドポイントに対して、各パーティションに合計300万件程度のレコードをINSERTします。
INSERT用スクリプト例
レコード件数が300万件入っていることを確認しました。
INPLACEリビルドが走るDDLを実行します。
2回目のDDL実行中(約7秒強)の間に、別のターミナルからリーダーエンドポイントに対してSELECTを実行すると、該当テーブルが見えなくなる現象が再現します。
DDLの実行が完了すると再びテーブルが見えるようになります。
Aurora MySQL 3.12.0(MySQL 8.0.44互換)でもバグは継続
先程のパーティショニングされたテーブルでバグの再現をします。
バージョン確認
DDL実行
2回目のDDL実行中にリーダーエンドポイントでSELECT実行すると、エラーが再発します。
Aurora MySQL 8.4.7 (MySQL 8.4.7互換)ではバグ解消
次のメジャーバージョンである、Aurora MySQL 8.4.7でも確認をしていきます。
バージョン確認
DDL実行
2回目のDDL実行中にリーダーエンドポイントにSELECTしてもエラーが出ません!
Aurora MySQL 3.10.5 (MySQL 8.0.42互換)でもバグ解消
2026年7月30日にリリースされたばかりの3.10.5で確認してみます。
バージョン確認
DDL実行
2回目のDDL実行中にリーダーエンドポイントにSELECTしてもエラーが出ません!
終わりに
2021年にリリースされたAurora MySQL バージョン3から、長らく続いていた根が深いバグについて紹介しました。
今回の事例では最新のAurora MySQL8.4.7、およびAurora MySQL 3.10.5でバグが解消されたことを確認できました。
しかし、まだ他のテーブル条件によってはバグが再発する可能性もあります。
影響の大きなテーブルに対してDDL実行する際は、十分に注意して作業しましょう。
SRGにご興味ありましたらぜひこちらからご連絡ください。
