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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 05b5a3738cd branch-2.1: [fix](build index)Fix non-master nodes cannot 
see the latest build index job status #44544 (#44630)
05b5a3738cd is described below

commit 05b5a3738cd6062f7152a45f91766f1dbdbdac37
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 27 22:51:10 2024 +0800

    branch-2.1: [fix](build index)Fix non-master nodes cannot see the latest 
build index job status #44544 (#44630)
    
    Cherry-picked from #44544
    
    Co-authored-by: qiye <l...@selectdb.com>
---
 .../src/main/java/org/apache/doris/alter/IndexChangeJob.java   |  1 +
 .../main/java/org/apache/doris/alter/SchemaChangeJobV2.java    |  2 +-
 .../java/org/apache/doris/analysis/ShowBuildIndexStmt.java     | 10 ++++++++++
 .../test_build_index_with_clone_fault.groovy                   |  1 +
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/alter/IndexChangeJob.java 
b/fe/fe-core/src/main/java/org/apache/doris/alter/IndexChangeJob.java
index 6b38daad8d6..8d78530e0aa 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/IndexChangeJob.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/IndexChangeJob.java
@@ -348,6 +348,7 @@ public class IndexChangeJob implements Writable {
             olapTable.readUnlock();
         }
         this.jobState = JobState.RUNNING;
+        // DO NOT write edit log here, tasks will be sent again if FE restart 
or master changed.
         LOG.info("transfer inverted index job {} state to {}", jobId, 
this.jobState);
     }
 
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 57088f6149d..7bf6925237d 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
@@ -482,7 +482,7 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
 
         this.jobState = JobState.RUNNING;
 
-        // DO NOT write edit log here, tasks will be send again if FE restart 
or master changed.
+        // DO NOT write edit log here, tasks will be sent again if FE restart 
or master changed.
         LOG.info("transfer schema change job {} state to {}", jobId, 
this.jobState);
     }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowBuildIndexStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowBuildIndexStmt.java
index 5b02e306aa9..5ae5f5e3606 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowBuildIndexStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowBuildIndexStmt.java
@@ -29,6 +29,7 @@ import org.apache.doris.common.proc.BuildIndexProcDir;
 import org.apache.doris.common.proc.ProcNodeInterface;
 import org.apache.doris.common.proc.ProcService;
 import org.apache.doris.common.util.OrderByPair;
+import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.qe.ShowResultSetMetaData;
 
 import com.google.common.base.Strings;
@@ -224,4 +225,13 @@ public class ShowBuildIndexStmt extends ShowStmt {
 
         return builder.build();
     }
+
+    @Override
+    public RedirectStatus getRedirectStatus() {
+        if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
+            return RedirectStatus.FORWARD_NO_SYNC;
+        } else {
+            return RedirectStatus.NO_FORWARD;
+        }
+    }
 }
diff --git 
a/regression-test/suites/fault_injection_p0/test_build_index_with_clone_fault.groovy
 
b/regression-test/suites/fault_injection_p0/test_build_index_with_clone_fault.groovy
index 0d73e4541b2..26ce762562b 100644
--- 
a/regression-test/suites/fault_injection_p0/test_build_index_with_clone_fault.groovy
+++ 
b/regression-test/suites/fault_injection_p0/test_build_index_with_clone_fault.groovy
@@ -55,6 +55,7 @@ suite("test_build_index_with_clone_fault_injection", 
"nonConcurrent"){
         while (attempt < maxRetries) {
             def show_build_index = sql_return_maparray("show build index where 
TableName = \"${tbl}\" ORDER BY JobId DESC LIMIT 1")
             if (show_build_index && show_build_index.size() > 0) {
+                logger.info("show build index result: ${show_build_index}")
                 def currentState = show_build_index[0].State
                 def currentMsg = show_build_index[0].Msg
                 if ((currentState == expectedState && currentMsg == 
expectedMsg) || currentState == "FINISHED") {


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

Reply via email to