You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2019/05/30 09:46:10 UTC

[ambari] branch trunk updated: [AMBARI-25240] : Dynamically update Rolling Upgrade Batch size (#2926)

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

amagyar pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 91f80c3  [AMBARI-25240] : Dynamically update Rolling Upgrade Batch size (#2926)
91f80c3 is described below

commit 91f80c3bce37d78dee64142544b2ab1ea5962bfb
Author: virajjasani <34...@users.noreply.github.com>
AuthorDate: Thu May 30 15:16:03 2019 +0530

    [AMBARI-25240] : Dynamically update Rolling Upgrade Batch size (#2926)
    
    * [AMBARI-25240] : Dynamically update Rolling Upgrade Batch size using cluster env property
    
    * minor code style fix
---
 .../org/apache/ambari/server/stack/MasterHostResolver.java    | 11 +++++++++++
 .../server/stack/upgrade/orchestrate/StageWrapperBuilder.java |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java
index ed90eed..449c507 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java
@@ -319,6 +319,17 @@ public class MasterHostResolver {
   }
 
   /**
+   * Find Config value for current Cluster using configType and propertyName
+   *
+   * @param configType   Config Type
+   * @param propertyName Property Name
+   * @return Value of property if present else null
+   */
+  public String getValueFromDesiredConfigurations(final String configType, final String propertyName) {
+    return m_configHelper.getValueFromDesiredConfigurations(m_cluster, configType, propertyName);
+  }
+
+  /**
    * Find the master and secondary namenode(s) based on JMX NameNodeStatus.
    */
   private HostsType.HighAvailabilityHosts findMasterAndSecondaries(NameService nameService, Set<String> componentHosts) throws ClassifyNameNodeException {
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/StageWrapperBuilder.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/StageWrapperBuilder.java
index d7e9b50..c3d586c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/StageWrapperBuilder.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/StageWrapperBuilder.java
@@ -31,7 +31,9 @@ import org.apache.ambari.server.stack.upgrade.ServerActionTask;
 import org.apache.ambari.server.stack.upgrade.ServiceCheckGrouping;
 import org.apache.ambari.server.stack.upgrade.Task;
 import org.apache.ambari.server.stack.upgrade.UpgradePack.ProcessingComponent;
+import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
 
 /**
  * Defines how to build stages for an Upgrade or Downgrade.
@@ -279,6 +281,11 @@ public abstract class StageWrapperBuilder {
 
     if (m_grouping.parallelScheduler != null) {
       int taskParallelism = m_grouping.parallelScheduler.maxDegreeOfParallelism;
+      String maxDegreeFromClusterEnv =
+              ctx.getResolver().getValueFromDesiredConfigurations(ConfigHelper.CLUSTER_ENV, "max_degree_parallelism");
+      if (StringUtils.isNotEmpty(maxDegreeFromClusterEnv) && StringUtils.isNumeric(maxDegreeFromClusterEnv)) {
+        taskParallelism = Integer.parseInt(maxDegreeFromClusterEnv);
+      }
       if (taskParallelism == ParallelScheduler.DEFAULT_MAX_DEGREE_OF_PARALLELISM) {
         taskParallelism = ctx.getDefaultMaxDegreeOfParallelism();
       }