You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by mc...@apache.org on 2019/03/09 00:21:00 UTC

[incubator-pinot] 01/01: Update the service status string to reflect the waiting condition

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

mcvsubbu pushed a commit to branch update-service-status-string
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 847cb9d9c150d808dfba41d41a8630eddb28c426
Author: Subbu Subramaniam <ss...@linkedin.com>
AuthorDate: Fri Mar 8 16:12:37 2019 -0800

    Update the service status string to reflect the waiting condition
    
    The method getServiceStatus() is defined in the templated abstract class
    IdealStateMatchServiceStatusCallback. Derived classes are used to compare
    against ExternalView or CurrentState. This should be reflected in the
    message to indicate whether we are waiting for externalview update or
    current state update.
---
 .../org/apache/pinot/common/utils/ServiceStatus.java | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java
index bdd5113..fe32e26 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/ServiceStatus.java
@@ -187,6 +187,8 @@ public class ServiceStatus {
 
     protected abstract Map<String, String> getPartitionStateMap(T state);
 
+    protected abstract String getMatchName();
+
     @Override
     public synchronized Status getServiceStatus() {
       if (_resourcesToMonitor.isEmpty()) {
@@ -205,8 +207,8 @@ public class ServiceStatus {
         }
 
         String descriptionSuffix = String
-            .format("resource=%s, numResourcesLeft=%d, numTotalResources=%d", resourceName, _resourcesToMonitor.size(),
-                _numTotalResourcesToMonitor);
+            .format("waitingFor=%s, resource=%s, numResourcesLeft=%d, numTotalResources=%d", getMatchName(),
+                resourceName, _resourcesToMonitor.size(), _numTotalResourcesToMonitor);
         T helixState = getState(resourceName);
         if (helixState == null) {
           _statusDescription = "Helix state does not exist: " + descriptionSuffix;
@@ -233,7 +235,7 @@ public class ServiceStatus {
               LOGGER.error(String.format("Resource: %s, partition: %s is in ERROR state", resourceName, partitionName));
             } else {
               _statusDescription = String
-                  .format("partition=%s, idealStateStatus=%s, currentStateStatus=%s, %s", partitionName,
+                  .format("partition=%s, expected=%s, found=%s, %s", partitionName,
                       idealStateStatus, currentStateStatus, descriptionSuffix);
               return Status.STARTING;
             }
@@ -265,6 +267,7 @@ public class ServiceStatus {
    * the ideal state value.
    */
   public static class IdealStateAndCurrentStateMatchServiceStatusCallback extends IdealStateMatchServiceStatusCallback<CurrentState> {
+    private static final String MATCH_NAME = "CurrentStateMatch";
     public IdealStateAndCurrentStateMatchServiceStatusCallback(HelixManager helixManager, String clusterName,
         String instanceName) {
       super(helixManager, clusterName, instanceName);
@@ -287,6 +290,11 @@ public class ServiceStatus {
     protected Map<String, String> getPartitionStateMap(CurrentState state) {
       return state.getPartitionStateMap();
     }
+
+    @Override
+    protected String getMatchName() {
+      return MATCH_NAME;
+    }
   }
 
   /**
@@ -295,6 +303,7 @@ public class ServiceStatus {
    * ideal state value.
    */
   public static class IdealStateAndExternalViewMatchServiceStatusCallback extends IdealStateMatchServiceStatusCallback<ExternalView> {
+    private static final String MATCH_NAME = "ExternalViewMatch";
     public IdealStateAndExternalViewMatchServiceStatusCallback(HelixManager helixManager, String clusterName,
         String instanceName) {
       super(helixManager, clusterName, instanceName);
@@ -323,5 +332,10 @@ public class ServiceStatus {
 
       return partitionState;
     }
+
+    @Override
+    protected String getMatchName() {
+      return MATCH_NAME;
+    }
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org