Bug #119508 Parallel `ALTER TABLE … CONVERT TO utf8mb4` on tables used by views leaves missing tablespaces on 8.0 and 8.4.
Submitted: 4 Dec 11:35
Reporter: Puneet Kaushik Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:8.0.43 OS:Any
Assigned to: CPU Architecture:Any

[4 Dec 11:35] Puneet Kaushik
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.