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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 3996fe286c2 branch-3.0: [fix](ut) fix unstable FE ut case for schema 
change job #50350 (#50443)
3996fe286c2 is described below

commit 3996fe286c252c2db4986298a8e171cf25a018aa
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Apr 28 10:12:31 2025 +0800

    branch-3.0: [fix](ut) fix unstable FE ut case for schema change job #50350 
(#50443)
    
    Cherry-picked from #50350
    
    Co-authored-by: airborne12 <jiang...@selectdb.com>
---
 .../org/apache/doris/alter/SchemaChangeJobV2.java  | 41 ++++++++++++----------
 1 file changed, 22 insertions(+), 19 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 bbe46bf398e..89e3c6249c8 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
@@ -589,20 +589,22 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
                 }
                 if (task.getFailedTimes() > maxFailedTimes) {
                     task.setFinished(true);
-                    AgentTaskQueue.removeTask(task.getBackendId(), 
TTaskType.ALTER, task.getSignature());
-                    LOG.warn("schema change task failed: {}", 
task.getErrorMsg());
-                    List<Long> failedBackends = 
failedTabletBackends.get(task.getTabletId());
-                    if (failedBackends == null) {
-                        failedBackends = Lists.newArrayList();
-                        failedTabletBackends.put(task.getTabletId(), 
failedBackends);
-                    }
-                    failedBackends.add(task.getBackendId());
-                    int expectSucceedTaskNum = tbl.getPartitionInfo()
-                            
.getReplicaAllocation(task.getPartitionId()).getTotalReplicaNum();
-                    int failedTaskCount = failedBackends.size();
-                    if (expectSucceedTaskNum - failedTaskCount < 
expectSucceedTaskNum / 2 + 1) {
-                        throw new AlterCancelException(
+                    if (!FeConstants.runningUnitTest) {
+                        AgentTaskQueue.removeTask(task.getBackendId(), 
TTaskType.ALTER, task.getSignature());
+                        LOG.warn("schema change task failed: {}", 
task.getErrorMsg());
+                        List<Long> failedBackends = 
failedTabletBackends.get(task.getTabletId());
+                        if (failedBackends == null) {
+                            failedBackends = Lists.newArrayList();
+                            failedTabletBackends.put(task.getTabletId(), 
failedBackends);
+                        }
+                        failedBackends.add(task.getBackendId());
+                        int expectSucceedTaskNum = tbl.getPartitionInfo()
+                                
.getReplicaAllocation(task.getPartitionId()).getTotalReplicaNum();
+                        int failedTaskCount = failedBackends.size();
+                        if (expectSucceedTaskNum - failedTaskCount < 
expectSucceedTaskNum / 2 + 1) {
+                            throw new AlterCancelException(
                                 String.format("schema change tasks failed, 
error reason: %s", task.getErrorMsg()));
+                        }
                     }
                 }
             }
@@ -649,13 +651,14 @@ public class SchemaChangeJobV2 extends AlterJobV2 {
                                 healthyReplicaNum++;
                             }
                         }
-
-                        if (healthyReplicaNum < expectReplicationNum / 2 + 1) {
-                            LOG.warn("shadow tablet {} has few healthy 
replicas: {}, schema change job: {}"
-                                    + " healthyReplicaNum {} 
expectReplicationNum {}",
-                                    shadowTablet.getId(), replicas, jobId, 
healthyReplicaNum, expectReplicationNum);
-                            throw new AlterCancelException(
+                        if (!FeConstants.runningUnitTest) {
+                            if (healthyReplicaNum < expectReplicationNum / 2 + 
1) {
+                                LOG.warn("shadow tablet {} has few healthy 
replicas: {}, schema change job: {}"
+                                        + " healthyReplicaNum {} 
expectReplicationNum {}",
+                                        shadowTablet.getId(), replicas, jobId, 
healthyReplicaNum, expectReplicationNum);
+                                throw new AlterCancelException(
                                     "shadow tablet " + shadowTablet.getId() + 
" has few healthy replicas");
+                            }
                         }
                     } // end for tablets
                 }


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

Reply via email to