helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hu...@apache.org
Subject [helix] 37/44: Skip the sibling checks for resource without minActiveReplica checks
Date Sat, 25 May 2019 01:20:11 GMT
This is an automated email from the ASF dual-hosted git repository.

hulee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git

commit ab1d6a409218121b37b35c262dca51dba9249411
Author: Yi Wang <ywang4@linkedin.com>
AuthorDate: Fri May 17 15:48:07 2019 -0700

    Skip the sibling checks for resource without minActiveReplica checks
    
    RB=1670752
    
    RB=1670752
    
    RB=1670752
    G=helix-reviewers
    A=jxue
    
    Signed-off-by: Hunter Lee <hulee@linkedin.com>
---
 .../main/java/org/apache/helix/util/InstanceValidationUtil.java   | 5 +++--
 .../java/org/apache/helix/util/TestInstanceValidationUtil.java    | 8 +++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/util/InstanceValidationUtil.java b/helix-core/src/main/java/org/apache/helix/util/InstanceValidationUtil.java
index 2d4d2ba..7239eeb 100644
--- a/helix-core/src/main/java/org/apache/helix/util/InstanceValidationUtil.java
+++ b/helix-core/src/main/java/org/apache/helix/util/InstanceValidationUtil.java
@@ -304,8 +304,9 @@ public class InstanceValidationUtil {
       // Get the minActiveReplicas constraint for the resource
       int minActiveReplicas = externalView.getMinActiveReplicas();
       if (minActiveReplicas == -1) {
-        throw new HelixException(
-            "ExternalView " + resourceName + " is missing minActiveReplica field");
+        _logger.warn("Resource " + resourceName
+            + " is missing minActiveReplica field. Skip the sibling check");
+        continue;
       }
       String stateModeDef = externalView.getStateModelDefRef();
       StateModelDefinition stateModelDefinition =
diff --git a/helix-core/src/test/java/org/apache/helix/util/TestInstanceValidationUtil.java
b/helix-core/src/test/java/org/apache/helix/util/TestInstanceValidationUtil.java
index 38b54f1..2b193b4 100644
--- a/helix-core/src/test/java/org/apache/helix/util/TestInstanceValidationUtil.java
+++ b/helix-core/src/test/java/org/apache/helix/util/TestInstanceValidationUtil.java
@@ -390,8 +390,8 @@ public class TestInstanceValidationUtil {
     Assert.assertFalse(result);
   }
 
-  @Test(expectedExceptions = HelixException.class)
-  public void TestSiblingNodesActiveReplicaCheck_exception_whenIdealStatesMisMatch() {
+  @Test
+  public void TestSiblingNodesActiveReplicaCheck_whenNoMinActiveReplica() {
     String resource = "resource";
     Mock mock = new Mock();
     doReturn(ImmutableList.of(resource)).when(mock.dataAccessor)
@@ -404,11 +404,13 @@ public class TestInstanceValidationUtil {
     doReturn(idealState).when(mock.dataAccessor).getProperty(argThat(new PropertyKeyArgument(PropertyType.IDEALSTATES)));
     //set externalView
     ExternalView externalView = mock(ExternalView.class);
+    // the resource sibling check will be skipped by design
     when(externalView.getMinActiveReplicas()).thenReturn(-1);
     doReturn(externalView).when(mock.dataAccessor)
         .getProperty(argThat(new PropertyKeyArgument(PropertyType.EXTERNALVIEW)));
 
-    InstanceValidationUtil.siblingNodesActiveReplicaCheck(mock.dataAccessor, TEST_INSTANCE);
+    boolean result = InstanceValidationUtil.siblingNodesActiveReplicaCheck(mock.dataAccessor,
TEST_INSTANCE);
+    Assert.assertTrue(result);
   }
 
   @Test(expectedExceptions = HelixException.class)


Mime
View raw message