ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alejan...@apache.org
Subject ambari git commit: AMBARI-14734. RU/EU, add PreCheck to prevent starting upgrade if a previous upgrade skipped the step Save DB State (alejandro)
Date Thu, 21 Jan 2016 19:17:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 c43706671 -> 5ccf5d4d3


AMBARI-14734. RU/EU, add PreCheck to prevent starting upgrade if a previous upgrade skipped
the step Save DB State (alejandro)


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

Branch: refs/heads/branch-2.2
Commit: 5ccf5d4d356a3f7635c2ef3531b93bae75a9b1f9
Parents: c437066
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Thu Jan 21 11:16:52 2016 -0800
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Thu Jan 21 11:16:52 2016 -0800

----------------------------------------------------------------------
 .../server/checks/AbstractCheckDescriptor.java  |   4 +
 .../ambari/server/checks/CheckDescription.java  |   7 +
 .../HiveDynamicServiceDiscoveryCheck.java       |   2 +-
 .../checks/HiveMultipleMetastoreCheck.java      |   2 +-
 .../server/checks/HostMaintenanceModeCheck.java |   2 +-
 .../checks/HostsMasterMaintenanceCheck.java     |   2 +-
 .../server/checks/InstallPackagesCheck.java     |   2 +-
 ...apReduce2JobHistoryStatePreservingCheck.java |   2 +-
 .../server/checks/PreviousUpgradeCompleted.java | 144 +++++++++++++++++++
 .../server/checks/RangerPasswordCheck.java      |   2 +-
 .../checks/SecondaryNamenodeDeletedCheck.java   |   2 +-
 .../checks/ServicesMaintenanceModeCheck.java    |   2 +-
 .../ServicesMapReduceDistributedCacheCheck.java |   2 +-
 .../ServicesNamenodeHighAvailabilityCheck.java  |   2 +-
 .../checks/ServicesNamenodeTruncateCheck.java   |   2 +-
 .../ServicesTezDistributedCacheCheck.java       |   2 +-
 .../checks/ServicesYarnWorkPreservingCheck.java |   2 +-
 .../server/checks/StormRestAPIDeletedCheck.java |   2 +-
 .../checks/YarnRMHighAvailabilityCheck.java     |   2 +-
 .../YarnTimelineServerStatePreservingCheck.java |   2 +-
 .../server/orm/dao/HostRoleCommandDAO.java      |   9 ++
 .../server/checks/UpgradeCheckOrderTest.java    |  26 ++--
 .../ambari/server/state/CheckHelperTest.java    |   2 +
 23 files changed, 192 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
index c29d64c..a8af073 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
@@ -29,6 +29,7 @@ import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.dao.ClusterVersionDAO;
 import org.apache.ambari.server.orm.dao.HostVersionDAO;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
+import org.apache.ambari.server.orm.dao.UpgradeDAO;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
@@ -67,6 +68,9 @@ public abstract class AbstractCheckDescriptor {
   Provider<RepositoryVersionDAO> repositoryVersionDaoProvider;
 
   @Inject
+  Provider<UpgradeDAO> upgradeDaoProvider;
+
+  @Inject
   Provider<RepositoryVersionHelper> repositoryVersionHelper;
 
   @Inject

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
index d20203c..a8c0525 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
@@ -152,6 +152,13 @@ public enum CheckDescription {
             "The following Services must be reinstalled: {{fails}}. Try to reinstall the
service components in INSTALL_FAILED state.");
       }}),
 
+  PREVIOUS_UPGRADE_COMPLETED(PrereqCheckType.CLUSTER,
+      "A previous upgrade did not complete.",
+      new HashMap<String, String>() {{
+        put(AbstractCheckDescriptor.DEFAULT,
+            "The last upgrade attempt did not complete. {{fails}}");
+      }}),
+
   INSTALL_PACKAGES_CHECK(PrereqCheckType.CLUSTER,
       "Install packages must be re-run",
       new HashMap<String, String>() {{

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
index 9ecabc7..77a85b9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
@@ -39,7 +39,7 @@ import com.google.inject.Singleton;
  * is properly configured for dynamic discovery.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 1.0f, required = true)
+@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 20.0f, required = true)
 public class HiveDynamicServiceDiscoveryCheck extends AbstractCheckDescriptor {
 
   static final String HIVE_DYNAMIC_SERVICE_DISCOVERY_ENABLED_KEY = "hive.dynamic-service.discovery.enabled.key";

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
index 14b8435..ea20a55 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
@@ -37,7 +37,7 @@ import com.google.inject.Singleton;
  * Metastore instances in the cluster.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.MULTIPLE_COMPONENT_WARNING, order = 1.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.MULTIPLE_COMPONENT_WARNING, order = 20.1f)
 public class HiveMultipleMetastoreCheck extends AbstractCheckDescriptor {
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/HostMaintenanceModeCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostMaintenanceModeCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostMaintenanceModeCheck.java
index 8708ef4..5e7bdef 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostMaintenanceModeCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostMaintenanceModeCheck.java
@@ -39,7 +39,7 @@ import com.google.inject.Singleton;
  * @see HostsHeartbeatCheck
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.MAINTENANCE_MODE, order = 3.0f, required = true)
+@UpgradeCheck(group = UpgradeCheckGroup.MAINTENANCE_MODE, order = 7.0f, required = true)
 public class HostMaintenanceModeCheck extends AbstractCheckDescriptor {
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
index 3126636..ec46be4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
@@ -40,7 +40,7 @@ import com.google.inject.Singleton;
  * Checks that all hosts in maintenance state do not have master components.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.MAINTENANCE_MODE, order = 1.0f, required = true)
+@UpgradeCheck(group = UpgradeCheckGroup.MAINTENANCE_MODE, order = 5.0f, required = true)
 public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor {
 
   static final String KEY_NO_UPGRADE_NAME = "no_upgrade_name";

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
index bbf2198..13e33f4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
@@ -42,7 +42,7 @@ import com.google.inject.Singleton;
  * Checks if Install Packages needs to be re-run
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 2.0f, required = true)
+@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 3.0f, required = true)
 public class InstallPackagesCheck extends AbstractCheckDescriptor {
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
index 626438f..06ca162 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
@@ -38,7 +38,7 @@ import java.util.Map;
  * is used to check that the MR2 History server has state preserving mode enabled.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.CONFIGURATION_WARNING, order = 1.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.CONFIGURATION_WARNING, order = 17.0f)
 public class MapReduce2JobHistoryStatePreservingCheck extends AbstractCheckDescriptor {
 
   final static String MAPREDUCE2_JOBHISTORY_RECOVERY_ENABLE_KEY =

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java
new file mode 100644
index 0000000..dfe17e6
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.checks;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
+import org.apache.ambari.server.orm.dao.RequestDAO;
+import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
+import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
+import org.apache.ambari.server.orm.entities.HostVersionEntity;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.orm.entities.RequestEntity;
+import org.apache.ambari.server.orm.entities.UpgradeEntity;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Host;
+import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.RepositoryVersionState;
+import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.upgrade.Direction;
+import org.apache.commons.lang.StringUtils;
+
+import javax.inject.Provider;
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Checks if Install Packages needs to be re-run
+ */
+@Singleton
+@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 4.0f, required = true)
+public class PreviousUpgradeCompleted extends AbstractCheckDescriptor {
+
+  /**
+   * If this ever changes, we will need to keep the historic name.
+   */
+  public static final String FINALIZE_ACTION_CLASS_NAME = "org.apache.ambari.server.serveraction.upgrades.FinalizeUpgradeAction";
+  public static final String SET_CURRENT_COMMAND = "ambari-server set-current --cluster-name=$CLUSTERNAME
--version-display-name=$VERSION_NAME";
+
+  @Inject
+  Provider<RequestDAO> requestDaoProvider;
+
+  @Inject
+  Provider<HostRoleCommandDAO> hostRoleCommandDaoProvider;
+
+  /**
+   * Constructor.
+   */
+  public PreviousUpgradeCompleted() {
+    super(CheckDescription.PREVIOUS_UPGRADE_COMPLETED);
+  }
+
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws
AmbariException {
+    final String clusterName = request.getClusterName();
+    final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+
+    String errorMessage = null;
+
+    List<UpgradeEntity> upgrades= upgradeDaoProvider.get().findAll();
+    if (upgrades != null) {
+      Long lastStartTime = 0L;
+      UpgradeEntity mostRecentUpgrade = null;
+      UpgradeEntity correspondingDowngrade = null;
+      for (UpgradeEntity upgrade : upgrades) {
+        // Find the most recent upgrade for this cluster
+        if (upgrade.getClusterId() == cluster.getClusterId() && upgrade.getDirection()
== Direction.UPGRADE) {
+          Long requestId = upgrade.getRequestId();
+          RequestEntity upgradeRequest = requestDaoProvider.get().findByPK(requestId);
+          if (upgradeRequest != null && upgradeRequest.getStartTime() > lastStartTime)
{
+            mostRecentUpgrade = upgrade;
+            lastStartTime = upgradeRequest.getStartTime();
+          }
+        }
+      }
+
+      // Check for the corresponding downgrade.
+      if (mostRecentUpgrade != null) {
+        for (UpgradeEntity downgrade : upgrades) {
+          // Surprisingly, a Downgrade's from and to version are identical.
+          if (downgrade.getClusterId() == cluster.getClusterId() && downgrade.getDirection()
== Direction.DOWNGRADE &&
+              downgrade.getFromVersion().equals(mostRecentUpgrade.getToVersion())) {
+            correspondingDowngrade = downgrade;
+            break;
+          }
+        }
+      }
+
+      // If it has no downgrade, then the "Save Cluster State" step should have COMPLETED.
+      if (correspondingDowngrade == null) {
+        // Should have only 1 element.
+        List<HostRoleCommandEntity> finalizeCommandList = hostRoleCommandDaoProvider.get().
+            findSortedCommandsByRequestIdAndCustomCommandName(mostRecentUpgrade.getRequestId(),
FINALIZE_ACTION_CLASS_NAME);
+
+        // If the action is not COMPLETED, then something went wrong.
+        if (finalizeCommandList != null) {
+          for (HostRoleCommandEntity command : finalizeCommandList) {
+            if (command.getStatus() != HostRoleStatus.COMPLETED) {
+              errorMessage = MessageFormat.format("Upgrade attempt (id: {0}, request id:
{1}, from version: {2}, " +
+                  "to version: {3}) did not complete task with id {4} since its state is
{5} instead of COMPLETED.",
+                  mostRecentUpgrade.getId(), mostRecentUpgrade.getRequestId(), mostRecentUpgrade.getFromVersion(),
+                  mostRecentUpgrade.getToVersion(), command.getTaskId(), command.getStatus());
+              errorMessage += " Please ensure that you called:\n" + SET_CURRENT_COMMAND;
+              errorMessage += MessageFormat.format("\nFurther, change the status of host_role_command
with " +
+                  "id {0} to COMPLETED", mostRecentUpgrade.getId());
+              break;
+            }
+          }
+        }
+      }
+    }
+
+    if (null != errorMessage) {
+      LinkedHashSet<String> failedOn = new LinkedHashSet<String>();
+      failedOn.add(cluster.getClusterName());
+      prerequisiteCheck.setFailedOn(failedOn);
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason(errorMessage);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
index 72091a4..33f971a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
@@ -50,7 +50,7 @@ import com.google.inject.Singleton;
  * user had changed the password using the Ranger UI.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.CONFIGURATION_WARNING, order = 1.1f, required=true)
+@UpgradeCheck(group = UpgradeCheckGroup.CONFIGURATION_WARNING, order = 23.0f, required=true)
 public class RangerPasswordCheck extends AbstractCheckDescriptor {
 
   private static final Logger LOG = LoggerFactory.getLogger(RangerPasswordCheck.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
index d7c27d7..4893098 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
@@ -41,7 +41,7 @@ import com.google.inject.Singleton;
  * Checks that the Secondary NameNode is not present on any of the hosts.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 2.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 16.0f)
 public class SecondaryNamenodeDeletedCheck extends AbstractCheckDescriptor {
   @Inject
   HostComponentStateDAO hostComponentStateDao;

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
index 8d578d8..18a5bde 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
@@ -33,7 +33,7 @@ import com.google.inject.Singleton;
  * Checks that services are in the maintenance mode.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.MAINTENANCE_MODE, order = 2.0f, required = true)
+@UpgradeCheck(group = UpgradeCheckGroup.MAINTENANCE_MODE, order = 6.0f, required = true)
 public class ServicesMaintenanceModeCheck extends AbstractCheckDescriptor {
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
index 8e98c99..3970e9e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
@@ -39,7 +39,7 @@ import com.google.inject.Singleton;
  * Checks that MR jobs reference hadoop libraries from the distributed cache.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 3.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 17.1f)
 public class ServicesMapReduceDistributedCacheCheck extends AbstractCheckDescriptor {
 
   static final String KEY_APP_CLASSPATH = "app_classpath";

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
index 44e183d..b7d2417 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
@@ -35,7 +35,7 @@ import com.google.inject.Singleton;
  * Checks that namenode high availability is enabled.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 1.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 16.1f)
 public class ServicesNamenodeHighAvailabilityCheck extends AbstractCheckDescriptor {
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
index cbb8623..35be754 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
@@ -33,7 +33,7 @@ import java.util.Map;
  * Checks that namenode high availability is enabled.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 1.1f)
+@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 16.2f)
 public class ServicesNamenodeTruncateCheck extends AbstractCheckDescriptor {
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
index 0a866eb..5dadcdd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
@@ -39,7 +39,7 @@ import com.google.inject.Singleton;
  * Checks that Tez jobs reference hadoop libraries from the distributed cache.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 4.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.NAMENODE_HA, order = 21.0f)
 public class ServicesTezDistributedCacheCheck extends AbstractCheckDescriptor {
 
   static final String KEY_LIB_URI_MISSING = "tez_lib_uri_missing";

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
index 062c11f..77605c1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
@@ -33,7 +33,7 @@ import java.util.Arrays;
  * Checks that YARN has work-preserving restart enabled.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 1.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 17.1f)
 public class ServicesYarnWorkPreservingCheck extends AbstractCheckDescriptor {
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/StormRestAPIDeletedCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/StormRestAPIDeletedCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/StormRestAPIDeletedCheck.java
index d3672b1..7071681 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/StormRestAPIDeletedCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/StormRestAPIDeletedCheck.java
@@ -40,7 +40,7 @@ import java.util.Set;
  * checks that STORM_REST_API Component is deleted when upgrading from HDP 2.1 to 2.2 or
higher.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.TOPOLOGY, order = 1.0f, required= false)
+@UpgradeCheck(group = UpgradeCheckGroup.TOPOLOGY, order = 15.0f, required= false)
 public class StormRestAPIDeletedCheck extends AbstractCheckDescriptor {
 
   @Inject

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
index 9f3bd6e..9dd4877 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
@@ -35,7 +35,7 @@ import com.google.inject.Singleton;
  * for ResourceManager..
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.MULTIPLE_COMPONENT_WARNING, order = 2.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.MULTIPLE_COMPONENT_WARNING, order = 17.2f)
 public class YarnRMHighAvailabilityCheck extends AbstractCheckDescriptor {
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
index 5dbd0b4..8cb8020 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
@@ -38,7 +38,7 @@ import com.google.inject.Singleton;
  * present in HDP 2.2.4.2+.
  */
 @Singleton
-@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 1.0f)
+@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 17.3f)
 public class YarnTimelineServerStatePreservingCheck extends AbstractCheckDescriptor {
 
   private final static String YARN_TIMELINE_STATE_RECOVERY_ENABLED_KEY = "yarn.timeline-service.recovery.enabled";

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
index c1fe36d..bd5fb5a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
@@ -208,6 +208,15 @@ public class HostRoleCommandDAO {
     return daoUtils.selectList(query, role, status);
   }
 
+  @RequiresSession
+  public List<HostRoleCommandEntity> findSortedCommandsByRequestIdAndCustomCommandName(Long
requestId, String customCommandName) {
+    TypedQuery<HostRoleCommandEntity> query = entityManagerProvider.get().createQuery("SELECT
hostRoleCommand " +
+        "FROM HostRoleCommandEntity hostRoleCommand " +
+        "WHERE hostRoleCommand.requestId=?1 AND hostRoleCommand.customCommandName=?2 " +
+        "ORDER BY hostRoleCommand.taskId", HostRoleCommandEntity.class);
+    return daoUtils.selectList(query, requestId, customCommandName);
+  }
+
 
   @RequiresSession
   public List<HostRoleCommandEntity> findSortedCommandsByStageAndHost(StageEntity stageEntity,
HostEntity hostEntity) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeCheckOrderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeCheckOrderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeCheckOrderTest.java
index 7d70311..d4ff566 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeCheckOrderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/UpgradeCheckOrderTest.java
@@ -76,28 +76,20 @@ public class UpgradeCheckOrderTest {
     for (AbstractCheckDescriptor check : checks) {
       UpgradeCheckGroup group = UpgradeCheckGroup.DEFAULT;
       UpgradeCheckGroup lastGroup = UpgradeCheckGroup.DEFAULT;
-      Float order = 1.0f;
-      Float lastOrder = 1.0f;
 
-      if (null == lastCheck) {
-        lastCheck = check;
-      }
-
-      UpgradeCheck annotation = check.getClass().getAnnotation(UpgradeCheck.class);
-      UpgradeCheck lastAnnotation = lastCheck.getClass().getAnnotation(UpgradeCheck.class);
+      if (null != lastCheck) {
 
-      if (null != annotation) {
-        group = annotation.group();
-        order = annotation.order();
-      }
+        UpgradeCheck annotation = check.getClass().getAnnotation(UpgradeCheck.class);
+        UpgradeCheck lastAnnotation = lastCheck.getClass().getAnnotation(UpgradeCheck.class);
 
-      if (null != lastAnnotation) {
-        lastGroup = lastAnnotation.group();
-        lastOrder = lastAnnotation.order();
+        if (null != annotation && null != lastAnnotation) {
+          group = annotation.group();
+          lastGroup = lastAnnotation.group();
+          Assert.assertTrue(lastGroup.getOrder().compareTo(group.getOrder()) <= 0);
+        }
       }
 
-      Assert.assertTrue(lastGroup.getOrder().compareTo(group.getOrder()) <= 0);
-      Assert.assertTrue(lastOrder.compareTo(order) <= 0);
+      lastCheck = check;
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ccf5d4d/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
index 0176f94..283a3ca 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
@@ -34,6 +34,7 @@ import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.orm.dao.ClusterVersionDAO;
 import org.apache.ambari.server.orm.dao.HostVersionDAO;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
+import org.apache.ambari.server.orm.dao.UpgradeDAO;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.state.stack.PrereqCheckStatus;
 import org.apache.ambari.server.state.stack.PrerequisiteCheck;
@@ -128,6 +129,7 @@ public class CheckHelperTest {
         bind(Clusters.class).toInstance(clusters);
         bind(ClusterVersionDAO.class).toProvider(Providers.<ClusterVersionDAO>of(null));
         bind(HostVersionDAO.class).toProvider(Providers.<HostVersionDAO>of(null));
+        bind(UpgradeDAO.class).toProvider(Providers.<UpgradeDAO>of(null));
         bind(RepositoryVersionDAO.class).toProvider(Providers.<RepositoryVersionDAO>of(null));
         bind(RepositoryVersionHelper.class).toProvider(Providers.<RepositoryVersionHelper>of(null));
         bind(AmbariMetaInfo.class).toProvider(Providers.<AmbariMetaInfo>of(null));


Mime
View raw message