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

dataroaring 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 de31d99d667 [fix](schema-change) Fix potential data race when a schema 
change jobs is set to cancelled but the table state is still SCHEMA_CHANGE 
(#39164)
de31d99d667 is described below

commit de31d99d667556747e9f17af7ea3337ce28f192c
Author: Siyang Tang <82279870+tangsiyang2...@users.noreply.github.com>
AuthorDate: Sat Aug 10 23:31:08 2024 +0800

    [fix](schema-change) Fix potential data race when a schema change jobs is 
set to cancelled but the table state is still SCHEMA_CHANGE (#39164)
    
    ## Proposed changes
    
    Set job cancel state after table state changed to normal.
---
 .../src/main/java/org/apache/doris/alter/SchemaChangeJobV2.java   | 8 +++-----
 1 file changed, 3 insertions(+), 5 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 f0d0df319c9..539ebcb6834 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
@@ -755,11 +755,11 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
         pruneMeta();
         this.errMsg = errMsg;
         this.finishedTimeMs = System.currentTimeMillis();
-        LOG.info("cancel {} job {}, err: {}", this.type, jobId, errMsg);
-        Env.getCurrentEnv().getEditLog().logAlterJob(this);
-
         changeTableState(dbId, tableId, OlapTableState.NORMAL);
         LOG.info("set table's state to NORMAL when cancel, table id: {}, job 
id: {}", tableId, jobId);
+        jobState = JobState.CANCELLED;
+        Env.getCurrentEnv().getEditLog().logAlterJob(this);
+        LOG.info("cancel {} job {}, err: {}", this.type, jobId, errMsg);
         postProcessShadowIndex();
 
         return true;
@@ -797,8 +797,6 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
                 }
             }
         }
-
-        jobState = JobState.CANCELLED;
     }
 
     // Check whether transactions of the given database which txnId is less 
than 'watershedTxnId' are finished


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to