@@ -589,20 +589,22 @@ protected void runRunningJob() throws AlterCancelException {
589
589
}
590
590
if (task .getFailedTimes () > maxFailedTimes ) {
591
591
task .setFinished (true );
592
- AgentTaskQueue .removeTask (task .getBackendId (), TTaskType .ALTER , task .getSignature ());
593
- LOG .warn ("schema change task failed: {}" , task .getErrorMsg ());
594
- List <Long > failedBackends = failedTabletBackends .get (task .getTabletId ());
595
- if (failedBackends == null ) {
596
- failedBackends = Lists .newArrayList ();
597
- failedTabletBackends .put (task .getTabletId (), failedBackends );
598
- }
599
- failedBackends .add (task .getBackendId ());
600
- int expectSucceedTaskNum = tbl .getPartitionInfo ()
601
- .getReplicaAllocation (task .getPartitionId ()).getTotalReplicaNum ();
602
- int failedTaskCount = failedBackends .size ();
603
- if (expectSucceedTaskNum - failedTaskCount < expectSucceedTaskNum / 2 + 1 ) {
604
- throw new AlterCancelException (
592
+ if (!FeConstants .runningUnitTest ) {
593
+ AgentTaskQueue .removeTask (task .getBackendId (), TTaskType .ALTER , task .getSignature ());
594
+ LOG .warn ("schema change task failed: {}" , task .getErrorMsg ());
595
+ List <Long > failedBackends = failedTabletBackends .get (task .getTabletId ());
596
+ if (failedBackends == null ) {
597
+ failedBackends = Lists .newArrayList ();
598
+ failedTabletBackends .put (task .getTabletId (), failedBackends );
599
+ }
600
+ failedBackends .add (task .getBackendId ());
601
+ int expectSucceedTaskNum = tbl .getPartitionInfo ()
602
+ .getReplicaAllocation (task .getPartitionId ()).getTotalReplicaNum ();
603
+ int failedTaskCount = failedBackends .size ();
604
+ if (expectSucceedTaskNum - failedTaskCount < expectSucceedTaskNum / 2 + 1 ) {
605
+ throw new AlterCancelException (
605
606
String .format ("schema change tasks failed, error reason: %s" , task .getErrorMsg ()));
607
+ }
606
608
}
607
609
}
608
610
}
@@ -649,13 +651,14 @@ protected void runRunningJob() throws AlterCancelException {
649
651
healthyReplicaNum ++;
650
652
}
651
653
}
652
-
653
- if (healthyReplicaNum < expectReplicationNum / 2 + 1 ) {
654
- LOG .warn ("shadow tablet {} has few healthy replicas: {}, schema change job: {}"
655
- + " healthyReplicaNum {} expectReplicationNum {}" ,
656
- shadowTablet .getId (), replicas , jobId , healthyReplicaNum , expectReplicationNum );
657
- throw new AlterCancelException (
654
+ if (! FeConstants . runningUnitTest ) {
655
+ if (healthyReplicaNum < expectReplicationNum / 2 + 1 ) {
656
+ LOG .warn ("shadow tablet {} has few healthy replicas: {}, schema change job: {}"
657
+ + " healthyReplicaNum {} expectReplicationNum {}" ,
658
+ shadowTablet .getId (), replicas , jobId , healthyReplicaNum , expectReplicationNum );
659
+ throw new AlterCancelException (
658
660
"shadow tablet " + shadowTablet .getId () + " has few healthy replicas" );
661
+ }
659
662
}
660
663
} // end for tablets
661
664
}
0 commit comments