Description:
Running concurrent `ALTER TABLE ... CONVERT TO utf8mb4` on tables used by views consistently triggers deadlocks and, on both 8.0.43 and 8.4.6-6, results in metadata inconsistencies where multiple tables report `ERROR 1812 (HY000): Tablespace is missing`. The issue was first observed in 8.0.34 and confirmed in 8.0.43 and 8.4.6-6. It reproduces only when the altered tables are referenced by views. Executing the same workload without views eliminates deadlocks and prevents the tablespace missing errors, indicating that view dependencies are a key factor in the failure.
How to repeat:
Reproduction
Deploy a fresh Percona Server environment as for example using `anydbver deploy ps:8`, then copy the provided scripts to reproduce the issue:
`drop_workbench_schemas.sh`
`create-tables.sh`
`create-tables_no_views.sh`
`alter-tables.sh`
`count_all_tables.sh`
Failing Scenario - Order of Scripts
```
./drop_workbench_schemas.sh
./create-tables.sh # creates base tables and corresponding views
./alter-tables.sh # runs ALTER TABLE ... CONVERT ... in parallel batches
# migration_logs/ captures deadlock and failure messages
./count_all_tables.sh # multiple tables now fail with ERROR 1812 (missing tablespace)
```
Passing Scenario
```
./drop_workbench_schemas.sh
./create-tables_no_views.sh # identical table set, but without views
./alter-tables.sh # migration_logs/ shows no deadlocks or errors
./count_all_tables.sh # all tables report COUNT(*) successfully
```
Removing the view definitions is sufficient to avoid the missing tablespace errors, even though the tables and alter batch size are unchanged.
Workarounds:
Workaround #1: Drop all views before running `ALTER TABLE ... CONVERT TO utf8mb4` operations and recreate them afterward.
Workaround #2: Run `ALTER TABLE ... CONVERT TO utf8mb4` sequentially instead of in parallel to avoid triggering the issue.
Description: Running concurrent `ALTER TABLE ... CONVERT TO utf8mb4` on tables used by views consistently triggers deadlocks and, on both 8.0.43 and 8.4.6-6, results in metadata inconsistencies where multiple tables report `ERROR 1812 (HY000): Tablespace is missing`. The issue was first observed in 8.0.34 and confirmed in 8.0.43 and 8.4.6-6. It reproduces only when the altered tables are referenced by views. Executing the same workload without views eliminates deadlocks and prevents the tablespace missing errors, indicating that view dependencies are a key factor in the failure. How to repeat: Reproduction Deploy a fresh Percona Server environment as for example using `anydbver deploy ps:8`, then copy the provided scripts to reproduce the issue: `drop_workbench_schemas.sh` `create-tables.sh` `create-tables_no_views.sh` `alter-tables.sh` `count_all_tables.sh` Failing Scenario - Order of Scripts ``` ./drop_workbench_schemas.sh ./create-tables.sh # creates base tables and corresponding views ./alter-tables.sh # runs ALTER TABLE ... CONVERT ... in parallel batches # migration_logs/ captures deadlock and failure messages ./count_all_tables.sh # multiple tables now fail with ERROR 1812 (missing tablespace) ``` Passing Scenario ``` ./drop_workbench_schemas.sh ./create-tables_no_views.sh # identical table set, but without views ./alter-tables.sh # migration_logs/ shows no deadlocks or errors ./count_all_tables.sh # all tables report COUNT(*) successfully ``` Removing the view definitions is sufficient to avoid the missing tablespace errors, even though the tables and alter batch size are unchanged. Workarounds: Workaround #1: Drop all views before running `ALTER TABLE ... CONVERT TO utf8mb4` operations and recreate them afterward. Workaround #2: Run `ALTER TABLE ... CONVERT TO utf8mb4` sequentially instead of in parallel to avoid triggering the issue.