文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

17.12.7 在线 DDL 失败条件17.12.7 Online DDL Failure Conditions

在线 DDL 操作失败通常是由于以下情况之一引起的:The failure of an online DDL operation is typically due to one of the following conditions:

  • ALGORITHM 子句指定的算法与特定类型的 DDL 操作或存储引擎不兼容。An ALGORITHM clause specifies an algorithm that is not compatible with the particular type of DDL operation or storage engine.

  • LOCK 子句指定了低级别的锁定(SHARED 或 NONE),这与特定类型的 DDL 操作不兼容。A LOCK clause specifies a low degree of locking (SHARED or NONE) that is not compatible with the particular type of DDL operation.

  • 在等待表的 独占锁 时发生超时,该锁可能在 DDL 操作的初始和最终阶段短暂需要。A timeout occurs while waiting for an exclusive lock on the table, which may be needed briefly during the initial and final phases of the DDL operation.

  • 在 MySQL 在创建索引期间将临时排序文件写入磁盘时,如果tmpdir或innodb_tmpdir文件系统磁盘空间不足,就会发生此情况。有关更多信息,请参阅第 17.12.3 节,“在线 DDL 空间要求”。The tmpdir or innodb_tmpdir file system runs out of disk space, while MySQL writes temporary sort files on disk during index creation. For more information, see Section 17.12.3, “Online DDL Space Requirements”.

  • 操作耗时较长,并且并发 DML 大量修改表,以至于临时在线日志的大小超过innodb_online_alter_log_max_size配置选项的值。此情况会导致DB_ONLINE_LOG_TOO_BIG错误。The operation takes a long time and concurrent DML modifies the table so much that the size of the temporary online log exceeds the value of the innodb_online_alter_log_max_size configuration option. This condition causes a DB_ONLINE_LOG_TOO_BIG error.

  • 并发 DML 对表进行了更改,这些更改在原始表定义下是允许的,但在新表定义下是不允许的。该操作仅在最后阶段失败,当 MySQL 尝试应用所有来自并发 DML 语句的更改时。例如,当正在创建唯一索引时,你可能会向列中插入重复值,或者在为该列创建主键索引时,你可能会向列中插入NULL值。并发 DML 所做的更改优先,ALTER TABLE操作实际上被回滚。Concurrent DML makes changes to the table that are allowed with the original table definition, but not with the new one. The operation only fails at the very end, when MySQL tries to apply all the changes from concurrent DML statements. For example, you might insert duplicate values into a column while a unique index is being created, or you might insert NULL values into a column while creating a primary key index on that column. The changes made by the concurrent DML take precedence, and the ALTER TABLE operation is effectively rolled back.