This is an automated email from the ASF dual-hosted git repository.

gavinchou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new e9ff4c2d047 [fix](fe) Restore rollup show state after metadata reload 
(#65869)
e9ff4c2d047 is described below

commit e9ff4c2d04707e0c62ac6cad05bc04572d7ad3e8
Author: Jamie <[email protected]>
AuthorDate: Thu Jul 30 13:08:30 2026 +0800

    [fix](fe) Restore rollup show state after metadata reload (#65869)
    
    ## What changed
    
    - Restore `showJobState` before the `origStmt == null` early return in
    `RollupJobV2.gsonPostProcess()`.
    - Add regression coverage for deserializing a persisted rollup job
    without `origStmt`.
    
    ## Why
    
    `showJobState` is not persisted. For rollup jobs created by `ALTER TABLE
    ... ADD ROLLUP`, `origStmt` can be null, so FE metadata reload returned
    before reconstructing `showJobState`. A subsequent `SHOW ALTER TABLE
    ROLLUP` or `SHOW ALTER TABLE MATERIALIZED VIEW` could then dereference a
    null state.
---
 .../java/org/apache/doris/alter/RollupJobV2.java   |  3 +-
 .../org/apache/doris/alter/RollupJobV2Test.java    | 37 ++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java 
b/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
index 8dd9d6ba1a2..b74c56f5b1f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/RollupJobV2.java
@@ -904,12 +904,13 @@ public class RollupJobV2 extends AlterJobV2 implements 
GsonPostProcessable {
 
     @Override
     public void gsonPostProcess() throws IOException {
+        showJobState = jobState;
+
         // analyze define stmt
         if (origStmt == null) {
             return;
         }
 
-        showJobState = jobState;
         if (jobState != JobState.PENDING) {
             return;
         }
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 f46afdc56fd..4265e267b7e 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
@@ -45,6 +45,7 @@ import org.apache.doris.meta.MetaContext;
 import org.apache.doris.nereids.trees.plans.commands.CancelAlterTableCommand;
 import org.apache.doris.nereids.trees.plans.commands.info.AddRollupOp;
 import org.apache.doris.nereids.trees.plans.commands.info.AlterOp;
+import org.apache.doris.persist.gson.GsonUtils;
 import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.qe.OriginStatement;
 import org.apache.doris.task.AgentBatchTask;
@@ -452,6 +453,42 @@ public class RollupJobV2Test {
                 resultColumn1.getName());
     }
 
+    @Test
+    public void testDeserializeOldRollupJobWithoutOrigStmt() {
+        String oldJson = "{"
+                + "\"clazz\":\"RollupJobV2\","
+                + "\"type\":\"ROLLUP\","
+                + "\"jobId\":1,"
+                + "\"jobState\":\"FINISHED\","
+                + "\"dbId\":1,"
+                + "\"tableId\":1,"
+                + "\"tableName\":\"test\","
+                + "\"errMsg\":\"\","
+                + "\"createTimeMs\":1,"
+                + "\"finishedTimeMs\":2,"
+                + "\"timeoutMs\":3,"
+                + "\"rawSql\":\"\","
+                + "\"watershedTxnId\":4,"
+                + "\"failedTabletBackends\":{},"
+                + "\"partitionIdToBaseRollupTabletIdMap\":{},"
+                + "\"partitionIdToRollupIndex\":{},"
+                + "\"baseIndexId\":1,"
+                + "\"rollupIndexId\":2,"
+                + "\"baseIndexName\":\"base\","
+                + "\"rollupIndexName\":\"rollup\","
+                + "\"rollupSchema\":[],"
+                + "\"baseSchemaHash\":1,"
+                + "\"rollupSchemaHash\":2,"
+                + "\"rollupKeysType\":\"AGG_KEYS\","
+                + "\"rollupShortKeyColumnCount\":1,"
+                + "\"storageFormat\":\"V2\","
+                + "\"sv\":{}"
+                + "}";
+
+        RollupJobV2 result = (RollupJobV2) GsonUtils.GSON.fromJson(oldJson, 
AlterJobV2.class);
+        Assert.assertEquals(JobState.FINISHED, 
Deencapsulation.getField(result, "showJobState"));
+    }
+
     @Test
     public void testAddRollupForDupTable() throws UserException {
         if (fakeEnv != null) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to