This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 82d94ffd224 branch-4.0:[fix](sync) Treat empty cancel alter job list
as all rollup jobs (#62712) (#62964)
82d94ffd224 is described below
commit 82d94ffd224c4a1ff5b3039c97e7426ffbf77e42
Author: seawinde <[email protected]>
AuthorDate: Thu May 28 10:17:58 2026 +0800
branch-4.0:[fix](sync) Treat empty cancel alter job list as all rollup jobs
(#62712) (#62964)
pr: #62712
commitId: 98b9338
---
.../doris/alter/MaterializedViewHandler.java | 2 +-
.../org/apache/doris/alter/RollupJobV2Test.java | 27 ++++++++++++++++++++++
.../doris/nereids/parser/NereidsParserTest.java | 10 ++++++++
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
b/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
index 90569f3d2f1..2a318726edd 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
@@ -1336,7 +1336,7 @@ public class MaterializedViewHandler extends AlterHandler
{
}
// find from new alter jobs first
- if (command.getAlterJobIdList() != null) {
+ if (command.getAlterJobIdList() != null &&
!command.getAlterJobIdList().isEmpty()) {
for (Long jobId : command.getAlterJobIdList()) {
AlterJobV2 alterJobV2 =
getUnfinishedAlterJobV2ByJobId(jobId);
if (alterJobV2 == null) {
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/alter/RollupJobV2Test.java
b/fe/fe-core/src/test/java/org/apache/doris/alter/RollupJobV2Test.java
index b95d055a94c..5e04452ec82 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/alter/RollupJobV2Test.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/alter/RollupJobV2Test.java
@@ -43,6 +43,8 @@ import org.apache.doris.common.FeMetaVersion;
import org.apache.doris.common.UserException;
import org.apache.doris.common.jmockit.Deencapsulation;
import org.apache.doris.meta.MetaContext;
+import org.apache.doris.nereids.trees.plans.commands.CancelAlterTableCommand;
+import org.apache.doris.nereids.trees.plans.commands.info.TableNameInfo;
import org.apache.doris.qe.OriginStatement;
import org.apache.doris.task.AgentTask;
import org.apache.doris.task.AgentTaskQueue;
@@ -164,6 +166,31 @@ public class RollupJobV2Test {
Assert.assertEquals(OlapTableState.ROLLUP, olapTable.getState());
}
+ @Test
+ public void testCancelRollupWithEmptyJobIdList() throws Exception {
+ fakeEnv = new FakeEnv();
+ fakeEditLog = new FakeEditLog();
+ FakeEnv.setEnv(masterEnv);
+ MaterializedViewHandler materializedViewHandler =
Env.getCurrentEnv().getMaterializedViewHandler();
+
+ ArrayList<AlterClause> alterClauses = new ArrayList<>();
+ alterClauses.add(clause);
+ Database db =
masterEnv.getInternalCatalog().getDbOrDdlException(CatalogTestUtil.testDb1);
+ OlapTable olapTable = (OlapTable)
db.getTableOrDdlException(CatalogTestUtil.testTableId1);
+ materializedViewHandler.process(alterClauses, db, olapTable);
+ Map<Long, AlterJobV2> alterJobsV2 =
materializedViewHandler.getAlterJobsV2();
+ Assert.assertEquals(1, alterJobsV2.size());
+
+ RollupJobV2 rollupJob = (RollupJobV2)
alterJobsV2.values().stream().findAny().get();
+ CancelAlterTableCommand cancelAlterTableCommand = new
CancelAlterTableCommand(
+ new TableNameInfo(db.getFullName(), olapTable.getName()),
+ CancelAlterTableCommand.AlterType.ROLLUP,
+ Lists.newArrayList());
+ materializedViewHandler.cancel(cancelAlterTableCommand);
+
+ Assert.assertEquals(JobState.CANCELLED, rollupJob.getJobState());
+ }
+
// start a schema change, then finished
@Test
public void testSchemaChange1() throws Exception {
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
index 86a92e7ae27..e2f7f5c267b 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
@@ -38,6 +38,7 @@ import org.apache.doris.nereids.trees.plans.DistributeType;
import org.apache.doris.nereids.trees.plans.JoinType;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.PlanType;
+import org.apache.doris.nereids.trees.plans.commands.CancelAlterTableCommand;
import
org.apache.doris.nereids.trees.plans.commands.CreateMaterializedViewCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateTableCommand;
import org.apache.doris.nereids.trees.plans.commands.CreateViewCommand;
@@ -119,6 +120,15 @@ public class NereidsParserTest extends ParserTestBase {
.assertMessageEquals("\nextraneous input 'illegal_symbol'
expecting {<EOF>, ';'}(line 1, pos 29)\n");
}
+ @Test
+ public void testCancelAlterTableWithoutJobIdsBuildsEmptyJobIdList() {
+ NereidsParser nereidsParser = new NereidsParser();
+ Plan plan = nereidsParser.parseSingle("CANCEL ALTER TABLE ROLLUP FROM
db1.tbl1");
+ Assertions.assertInstanceOf(CancelAlterTableCommand.class, plan);
+ CancelAlterTableCommand command = (CancelAlterTableCommand) plan;
+ Assertions.assertTrue(command.getAlterJobIdList().isEmpty());
+ }
+
@Test
public void testPostProcessor() {
parsePlan("select `AD``D` from t1 where a = 1")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]