ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [7/8] ambari git commit: AMBARI-18560. Add more logging to track what condition resulted in skipping agent commands. (stoader)
Date Mon, 10 Oct 2016 14:40:54 GMT
AMBARI-18560. Add more logging to track what condition resulted in skipping agent commands.
(stoader)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d1d5f9b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d1d5f9b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d1d5f9b

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 2d1d5f9b00e39a137c5aea8341436f408975cf82
Parents: 58afcf9
Author: Toader, Sebastian <stoader@hortonworks.com>
Authored: Mon Oct 10 16:06:55 2016 +0200
Committer: Toader, Sebastian <stoader@hortonworks.com>
Committed: Mon Oct 10 16:06:55 2016 +0200

----------------------------------------------------------------------
 .../AmbariManagementControllerImpl.java         |  2 +-
 .../controller/ServiceComponentHostRequest.java |  4 +-
 .../internal/HostComponentResourceProvider.java | 44 ++++++++++----------
 3 files changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1d5f9b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 1fc9dbf..ef4fc33 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -2474,7 +2474,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     if ((changedServices == null || changedServices.isEmpty())
         && (changedComps == null || changedComps.isEmpty())
         && (changedScHosts == null || changedScHosts.isEmpty())) {
-      LOG.debug("Created 0 stages");
+      LOG.info("Created 0 stages");
       return requestStages;
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1d5f9b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
index 73cedb4..4a07804 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
@@ -182,7 +182,9 @@ public class ServiceComponentHostRequest {
       .append(", state=").append(state)
       .append(", desiredStackId=").append(desiredStackId)
       .append(", staleConfig=").append(staleConfig)
-      .append(", adminState=").append(adminState).append("}");
+      .append(", adminState=").append(adminState)
+      .append(", maintenanceState=").append(maintenanceState)
+      .append("}");
     return sb.toString();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1d5f9b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
index 85a4949..4f279c8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
@@ -580,7 +580,7 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
       }
 
       if (newState == null) {
-        logComponentInfo("Nothing to do for new updateServiceComponentHost", request, oldState,
null);
+        LOG.info(getServiceComponentRequestInfoLogMessage("Nothing to do for new updateServiceComponentHost",
request, oldState, null));
         continue;
       }
 
@@ -594,7 +594,7 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
       if (sc.isClientComponent() && newState == State.STARTED &&
             !requestProperties.containsKey(sch.getServiceComponentName().toLowerCase()))
{
         ignoredScHosts.add(sch);
-        logComponentInfo("Ignoring ServiceComponentHost", request, sch.getState(), newState);
+        LOG.info(getServiceComponentRequestInfoLogMessage("Ignoring ServiceComponentHost
as STARTED new desired state for client components is not valid", request, sch.getState(),
newState));
         continue;
       }
 
@@ -610,13 +610,13 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
           !requestProperties.containsKey(sch.getServiceComponentName().toLowerCase())) {
 
         ignoredScHosts.add(sch);
-        logComponentInfo("Ignoring ServiceComponentHost", request, oldState, newState);
+        LOG.info(getServiceComponentRequestInfoLogMessage("Ignoring ServiceComponentHost
as the current state matches the new desired state", request, oldState, newState));
         continue;
       }
 
       if (! maintenanceStateHelper.isOperationAllowed(reqOpLvl, sch)) {
         ignoredScHosts.add(sch);
-        logComponentInfo("Ignoring ServiceComponentHost", request, oldState, newState);
+        LOG.info(getServiceComponentRequestInfoLogMessage("Ignoring ServiceComponentHost
as operation is not allowed", request, oldState, newState));
         continue;
       }
 
@@ -632,7 +632,7 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
       }
 
       if (isDirectTransition(oldSchState, newState)) {
-        logComponentInfo("Handling direct transition update to host component", request,
oldState, newState);
+        LOG.info(getServiceComponentRequestInfoLogMessage("Handling direct transition update
to host component", request, oldState, newState));
         directTransitionScHosts.put(sch, newState);
       } else {
         if (!changedScHosts.containsKey(sc.getName())) {
@@ -643,7 +643,7 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
           changedScHosts.get(sc.getName()).put(newState,
               new ArrayList<ServiceComponentHost>());
         }
-        logComponentInfo("Handling update to host component", request, oldState, newState);
+        LOG.info(getServiceComponentRequestInfoLogMessage("Handling update to host component",
request, oldState, newState));
         changedScHosts.get(sc.getName()).get(newState).add(sch);
       }
     }
@@ -937,22 +937,24 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
   }
 
   /**
-   * Logs component info.
-   *
-   * @param msg              base log msg
-   * @param request          the request to log
-   * @param oldState         current state
-   * @param newDesiredState  new desired state
+   * Constructs INFO level log message for {@link ServiceComponentHostRequest}
+   * @param msg base  message
+   * @param request the request to construct the log message for
+   * @param oldState current state of the service host component that the request is for.
+   * @param newDesiredState new desired state for the service host component
    */
-  private void logComponentInfo(String msg, ServiceComponentHostRequest request, State oldState,
State newDesiredState) {
-    LOG.debug("{}, clusterName={}, serviceName={}, componentName={}, hostname={}, currentState={},
newDesiredState={}",
-        msg,
-        request.getClusterName(),
-        request.getServiceName(),
-        request.getComponentName(),
-        request.getHostname(),
-        oldState == null ? "null" : oldState,
-        newDesiredState == null ? "null" : newDesiredState);
+  private String getServiceComponentRequestInfoLogMessage(String msg, ServiceComponentHostRequest
request, State oldState, State newDesiredState) {
+    StringBuilder sb = new StringBuilder();
+
+    sb.append(msg)
+      .append(", clusterName=").append(request.getClusterName())
+      .append(", serviceName=").append(request.getServiceName())
+      .append(", componentName=").append(request.getComponentName())
+      .append(", hostname=").append(request.getHostname())
+      .append(", currentState=").append(oldState == null ? "null" : oldState)
+      .append(", newDesiredState=").append(newDesiredState == null ? "null" : newDesiredState);
+
+    return sb.toString();
   }
 
   /**


Mime
View raw message