Browse Source

AMBARI-9168. RU - ZK Client needs to advertise version for Finalize to work (alejandro)

Alejandro Fernandez 10 years ago
parent
commit
c9f875d84e

+ 2 - 3
ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java

@@ -1736,11 +1736,10 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
       }
     }
 
-    //TODO hack: clients' states are not updated, probably we should check the state of master components
+    // ZKFC is special because it is does not receive a RESTART action during a Rolling Upgrade.
     final Collection<HostComponentStateEntity> nonUpgradedHostComponents = CollectionUtils.subtract(allHostComponents, upgradedHostComponents);
     for (HostComponentStateEntity hostComponentStateEntity: nonUpgradedHostComponents) {
-      final Service service = cluster.getService(hostComponentStateEntity.getServiceName());
-      if (service.getServiceComponent(hostComponentStateEntity.getComponentName()).isClientComponent()) {
+      if (hostComponentStateEntity.getComponentName().equalsIgnoreCase("ZKFC")) {
         upgradedHostComponents.add(hostComponentStateEntity);
       }
     }

+ 3 - 5
ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode_upgrade.py

@@ -47,9 +47,7 @@ def post_upgrade_check():
     raise Fail("Need at least 3 Journalnodes to maintain a quorum")
 
   # TODO, test with HTTPS
-  policy = default("/configurations/hdfs-site/dfs.http.policy", None)
-  if not policy:
-    raise Fail("Could not retrieve dfs.http.policy")
+  policy = default("/configurations/hdfs-site/dfs.http.policy", "HTTP_ONLY")
   encrypted = policy.upper == "HTTPS_ONLY"
 
   nn_address = default("/configurations/hdfs-site/dfs.namenode.https-address", None) if encrypted else \
@@ -136,10 +134,10 @@ def ensure_jns_have_new_txn(nodes, last_txn_id):
       if data:
         actual_txn_ids[node] = int(data)
         if actual_txn_ids[node] >= last_txn_id:
-          Logger.info("Journalnode %s has a higher transaction id: %s" + str(data))
+          Logger.info("Journalnode %s has a higher transaction id: %s" % (node, str(data)))
           jns_updated += 1
         else:
-          Logger.info("Journalnode %s is still on transaction id: %s" + str(data))
+          Logger.info("Journalnode %s is still on transaction id: %s" % (node, str(data)))
 
     Logger.info("Sleeping for %d secs" % step_time_secs)
     time.sleep(step_time_secs)

+ 21 - 0
ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_client.py

@@ -21,6 +21,8 @@ Ambari Agent
 
 import sys
 from resource_management import *
+from resource_management.libraries.functions.version import compare_versions, format_hdp_stack_version
+from resource_management.libraries.functions.format import format
 
 from zookeeper import zookeeper
 
@@ -39,6 +41,25 @@ class ZookeeperClient(Script):
 
     zookeeper(type='client')
 
+  def pre_rolling_restart(self, env):
+    Logger.info("Executing Rolling Upgrade pre-restart")
+    import params
+    env.set_params(params)
+
+    if params.version and compare_versions(format_hdp_stack_version(params.version), '2.2.0.0') >= 0:
+      Execute(format("hdp-select set zookeeper-client {version}"))
+
+  def start(self, env, rolling_restart=False):
+    import params
+    env.set_params(params)
+    self.configure(env)
+    pass
+
+  def stop(self, env, rolling_restart=False):
+    import params
+    env.set_params(params)
+    pass
+
   def status(self, env):
     raise ClientComponentHasNoStatus()
 

+ 6 - 0
ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.2.xml

@@ -203,6 +203,12 @@
           <task xsi:type="restart" />
         </upgrade>
       </component>
+
+      <component name="ZOOKEEPER_CLIENT">
+        <upgrade>
+          <task xsi:type="restart" />
+        </upgrade>
+      </component>
     </service>
 
     <service name="HDFS">