From a18b211c6e045283a78e9ab7fb55ee8222f5dc19 Mon Sep 17 00:00:00 2001 From: Siyang Tang <82279870+TangSiyang2001@users.noreply.github.com> Date: Tue, 29 Oct 2024 22:31:59 +0800 Subject: [PATCH] [fix](schema-change) Make sc job state updated after the table state is changed (#42670) Similar to #39327 Note that schema change job state and table state should be atomic and persistent, but neither is ensured by current implementation. We should optimize this point in the future. --- .../java/org/apache/doris/alter/SchemaChangeJobV2.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java index 5f8fe8660b5807..8467096236b8ac 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java @@ -656,14 +656,16 @@ protected void runRunningJob() throws AlterCancelException { } pruneMeta(); - this.jobState = JobState.FINISHED; - this.finishedTimeMs = System.currentTimeMillis(); - Env.getCurrentEnv().getEditLog().logAlterJob(this); LOG.info("schema change job finished: {}", jobId); changeTableState(dbId, tableId, OlapTableState.NORMAL); LOG.info("set table's state to NORMAL, table id: {}, job id: {}", tableId, jobId); + + this.jobState = JobState.FINISHED; + this.finishedTimeMs = System.currentTimeMillis(); + Env.getCurrentEnv().getEditLog().logAlterJob(this); + postProcessOriginIndex(); // Drop table column stats after schema change finished. Env.getCurrentEnv().getAnalysisManager().dropStats(tbl, null);