[ 
https://issues.apache.org/jira/browse/SCB-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16579306#comment-16579306
 ] 

ASF GitHub Bot commented on SCB-832:
------------------------------------

liubao68 closed pull request #867: [SCB-832] modify the 
errorThresholdPercentage from 20 to 0
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/867
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
index bdc38317f..f2f8f624d 100644
--- 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
+++ 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java
@@ -184,8 +184,8 @@ public boolean isIsolationFilterOpen(String microservice) {
   }
 
   public int getErrorThresholdPercentage(String microservice) {
-    final int defaultValue = 20;
-    String p = getStringProperty("20",
+    final int defaultValue = 0;
+    String p = getStringProperty("0",
         PROP_ROOT + microservice + "." + FILTER_ISOLATION + 
FILTER_ERROR_PERCENTAGE,
         PROP_ROOT + FILTER_ISOLATION + FILTER_ERROR_PERCENTAGE);
     try {
diff --git 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/IsolationDiscoveryFilter.java
 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/IsolationDiscoveryFilter.java
index b8d45b577..6cfadb79c 100644
--- 
a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/IsolationDiscoveryFilter.java
+++ 
b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/IsolationDiscoveryFilter.java
@@ -161,6 +161,9 @@ private boolean checkThresholdAllowed(Settings settings, 
ServiceCombServerStats
       }
     }
 
+    if (settings.errorThresholdPercentage == 0) {
+      return true;
+    }
     if (serverStats.getFailedRate() >= settings.errorThresholdPercentage) {
       return false;
     }
diff --git 
a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceHandler2.java
 
b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceHandler2.java
index a0c3c1015..b5262b54c 100644
--- 
a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceHandler2.java
+++ 
b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceHandler2.java
@@ -149,6 +149,15 @@ public void testZoneAwareAndIsolationFilterWorks() {
     ServiceCombLoadBalancerStats.INSTANCE.markSuccess(server);
     ServiceCombLoadBalancerStats.INSTANCE.markSuccess(server);
     ServiceCombLoadBalancerStats.INSTANCE.markFailure(server);
+
+    //if errorThresholdPercentage is 0,that means errorThresholdPercentage is 
not active.
+    
ArchaiusUtils.setProperty("servicecomb.loadbalance.isolation.errorThresholdPercentage",
 "0");
+    loadBalancer = handler.getOrCreateLoadBalancer(invocation);
+    server = (ServiceCombServer) loadBalancer.chooseServer();
+    Assert.assertEquals(server.getEndpoint().getEndpoint(), 
"rest://localhost:9090");
+
+    //if errorThresholdPercentage greater than 0, it will activate.
+    
ArchaiusUtils.setProperty("servicecomb.loadbalance.isolation.errorThresholdPercentage",
 "20");
     ServiceCombServer server2 = server;
     loadBalancer = handler.getOrCreateLoadBalancer(invocation);
     server = (ServiceCombServer) loadBalancer.chooseServer();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> modify the errorThresholdPercentage from 20 to 0
> ------------------------------------------------
>
>                 Key: SCB-832
>                 URL: https://issues.apache.org/jira/browse/SCB-832
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Java-Chassis
>            Reporter: WeiChao
>            Assignee: WeiChao
>            Priority: Major
>             Fix For: java-chassis-1.1.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to