mysql – 你可以在’将alter table提交到存储引擎’的状态下回滚查询

我们有一个包含7000万行的InnoDB表,我们一直在尝试运行一个alter table语句来修改添加几列.查询似乎已经改变了表,现在处于“将alter table提交到存储引擎”的状态.

START TRANSACTION;
ALTER TABLE table
  MODIFY COLUMN column1 int(11) NOT NULL DEFAULT 0,
  MODIFY COLUMN column2 tinyint(1) NOT NULL DEFAULT 1,
  ADD COLUMN column3 int(11),
  ADD COLUMN column4 int(11) NOT NULL DEFAULT 1,
  ADD COLUMN column5 varchar(255);
COMMIT;

这已经过夜了,现在是19小时.我们没有启用性能架构,因此无法查看估计的完成时间.我担心的是查询正在做什么以及查询是否会在被杀死时回滚.我已经看到其他问题涉及到复制到tmp表或等待表锁的查询.但是,当alter table提交时,我找不到任何关于被卡住的事情.

在此状态下终止查询是否安全,如果查询被终止,它是否会成功回滚?

服务器正在运行MariaDB 10.2

最佳答案:

documentation

Some statements cannot be rolled back. In general, these include data deFinition language (DDL) statements, such as those that create or drop databases, those that create, drop, or alter tables or stored routines.

You should design your transactions not to include such statements. If you issue a statement early in a transaction that cannot be rolled back, and then another statement later fails, the full effect of the transaction cannot be rolled back in such cases by issuing a ROLLBACK statement.

相关文章

安装开始...1.打开“https://dev.mysql.com/downloadsepo/yu...
安装Helm3#官网下载慢#wgethttps://get.helm.sh/helm-v3.5.4...
通过Linux命令行启动用的指令:systemctlstartmariadb.servi...
InstallingMariaDBServer10.4TodeployMariaDBCommunityServe...
阅读目录一什么是存储引擎二mysql支持的存储引擎三使用存储引...
1、安装MariaDB安装命令yum-yinstallmariadbmariadb-server安...