From c2a17b8ad9b5975db2e73d4d2a74a953ba05c547 Mon Sep 17 00:00:00 2001 From: Siyang Tang Date: Fri, 3 Jan 2025 19:25:43 +0800 Subject: [PATCH] [fix](schema-change) Fix job replay failure when partitions added to table after job finish (#46166) (#46367) Cherry-picked from #46166 --- .../apache/doris/alter/SchemaChangeJobV2.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 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 7bf6925237..e98d8066a1 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 @@ -586,21 +586,21 @@ public class SchemaChangeJobV2 extends AlterJobV2 { } // end for partitions // all partitions are good onFinished(tbl); + + pruneMeta(); + + 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); } finally { tbl.writeUnlock(); } - pruneMeta(); - - 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); - // Drop table column stats after schema change finished. Env.getCurrentEnv().getAnalysisManager().dropStats(tbl); }