表结构变更后,拿不到实时的table state

【详述】拿不到实时的table state,没办法知道表结构是否还在变动
【背景】在表结构变更发起后,采用SHOW ALTER TABLE COLUMN这个SQL查询正在进行的alter任务,查询的结果显示任务结束,但实际任务是没结束的,导致再次进行表结构变更时报错
【业务影响】表结构变更报错
【StarRocks版本】例如:2.5
【联系方式】小张-1437198718@qq.com

再次变更报错是啥

Unexpected exception: The state of “dqeqe1” is SCHEMA_CHANGE. Alter operation is only permitted if NORMAL“

show alter table columns的截图还有么

这两个SQL返回的跟实际他存储的table状态不是同步的

leader fe日志中搜下dpeqe1看下

这个怎么弄呢? 。

或者leader fe日志发下,我们分析下

2023-11-17 11:34:41,366 WARN (starrocks-mysql-nio-pool-210|368517) [StmtExecutor.handleDdlStmt():1213] DDL statement (ALTER TABLE detail333333 MODIFY COLUMN channel INT(11) NULL COMMENT “ddd” AFTER device_code) process failed.
com.starrocks.common.DdlException: The state of “detail333333” is SCHEMA_CHANGE. Alter operation is only permitted if NORMAL
at com.starrocks.alter.Alter.processAlterTable(Alter.java:695) ~[starrocks-fe.jar:?]
at com.starrocks.server.LocalMetastore.alterTable(LocalMetastore.java:3216) ~[starrocks-fe.jar:?]
at com.starrocks.server.GlobalStateMgr.alterTable(GlobalStateMgr.java:2988) ~[starrocks-fe.jar:?]
at com.starrocks.qe.DDLStmtExecutor$StmtExecutorVisitor.lambda$visitAlterTableStatement$13(DDLStmtExecutor.java:293) ~[starrocks-fe.jar:?]
at com.starrocks.common.ErrorReport.wrapWithRuntimeException(ErrorReport.java:103) ~[starrocks-fe.jar:?]
at com.starrocks.qe.DDLStmtExecutor$StmtExecutorVisitor.visitAlterTableStatement(DDLStmtExecutor.java:292) ~[starrocks-fe.jar:?]
at com.starrocks.qe.DDLStmtExecutor$StmtExecutorVisitor.visitAlterTableStatement(DDLStmtExecutor.java:131) ~[starrocks-fe.jar:?]
at com.starrocks.sql.ast.AlterTableStmt.accept(AlterTableStmt.java:33) ~[starrocks-fe.jar:?]
at com.starrocks.qe.DDLStmtExecutor.execute(DDLStmtExecutor.java:117) ~[starrocks-fe.jar:?]
at com.starrocks.qe.StmtExecutor.handleDdlStmt(StmtExecutor.java:1187) ~[starrocks-fe.jar:?]
at com.starrocks.qe.StmtExecutor.execute(StmtExecutor.java:507) ~[starrocks-fe.jar:?]
at com.starrocks.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:327) ~[starrocks-fe.jar:?]
at com.starrocks.qe.ConnectProcessor.dispatch(ConnectProcessor.java:444) ~[starrocks-fe.jar:?]
at com.starrocks.qe.ConnectProcessor.processOnce(ConnectProcessor.java:711) ~[starrocks-fe.jar:?]
at com.starrocks.mysql.nio.ReadListener.lambda$handleEvent$0(ReadListener.java:55) ~[starrocks-fe.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_271]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_271]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_271]

完整的fe日志麻烦发下,我们看下上下文,为啥table不是normal

日志等会,问题是在发起两处变更后,再次变更提交就出现Unexpected exception: The state of “dqeqe1” is SCHEMA_CHANGE. Alter operation is only permitted if NORMAL。是系统只执行了1个变更吧,另一个没执行?

你好,我们的项目中也出现了这样的问题,想问一下大佬你们是如何解决的?

看上面的案例,因为是它发起了两次变更,有一次没变更成功导致的异常,不知道我理解的对不对,如果你也遇到这个问题,我理解两次变更操作执行的间隙中,你再做每次变更时都提前去检测上一次变更是否完成,如果完成再提交这次变更

是的,执行alter table的操作非常耗时,我是drop column后,任务没执行完,就执行add column,然后报错了;需要等待上一步操作结束后才能执行新的alter table