AMBARI-2124. Hive client is not getting reconfigured when it is co-hosted with hive server/metastore. (swagle)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/branch-1.2.3@1482454 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 813d3da..d6343dc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -630,6 +630,9 @@
 
  BUG FIXES
 
+ AMBARI-2124. Hive client is not getting reconfigured when it is co-hosted 
+ with hive server/metastore. (swagle)
+
  AMBARI-2072. Fix to remove actual_configs from cluster response. (ncole)
 
  AMBARI-2036. Fix to send global configs with status_commands to agents. (ncole)
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 f094873..1ecdc28 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
@@ -1875,28 +1875,15 @@
     for (String serviceName : services) {
       Service s = cluster.getService(serviceName);
       for (String component : s.getServiceComponents().keySet()) {
-        List<ServiceComponentHost> potentialHosts = null;
+        List<ServiceComponentHost> potentialHosts = new
+          ArrayList<ServiceComponentHost>();
         ServiceComponent sc = s.getServiceComponents().get(component);
         if (sc.isClientComponent()) {
-          potentialHosts = new ArrayList<ServiceComponentHost>();
-          // Check if the Client components are in the list of changed hosts
-          if (existingSchs != null && !existingSchs.isEmpty()) {
-            for (ServiceComponentHost potentialSch : sc
-              .getServiceComponentHosts().values()) {
-              boolean addSch = true;
-              // Ignore the Sch if same service has changed on the same host
-              for (ServiceComponentHost existingSch : existingSchs) {
-                if (potentialSch.getHostName().equals(existingSch
-                    .getHostName()) && potentialSch.getServiceName().equals
-                    (existingSch.getServiceName())) {
-                  addSch = false;
-                  break;
-                }
-              }
-              if (addSch && !potentialSch.getHostState().equals(HostState
-                .HEARTBEAT_LOST)) {
-                potentialHosts.add(potentialSch);
-              }
+          for (ServiceComponentHost potentialSch : sc
+            .getServiceComponentHosts().values()) {
+            if (!potentialSch.getHostState().equals(HostState
+              .HEARTBEAT_LOST)) {
+              potentialHosts.add(potentialSch);
             }
           }
         }
@@ -1905,8 +1892,7 @@
         }
       }
     }
-    LOG.info("Client hosts for reinstall : " + clientSchs.size
-      ());
+    LOG.info("Client hosts for reinstall : " + clientSchs.size());
 
     for (String sc : clientSchs.keySet()) {
       Map<State, List<ServiceComponentHost>> schMap = new
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 020df22..47c9419 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -4512,7 +4512,7 @@
       }
     }
     Assert.assertNotNull(hdfsCmdHost3);
-    Assert.assertNull(hdfsCmdHost2);
+    Assert.assertNotNull(hdfsCmdHost2);
     ExecutionCommand execCmd = hdfsCmdHost3.getExecutionCommandWrapper()
       .getExecutionCommand();
     Assert.assertEquals(2, execCmd.getConfigurationTags().size());