Browse Source

AMBARI-14052. Express Upgrade : Unable to start Storm Supervisor in HDP 2.1->2.3.M20 and config symlink is wrong (Swapan Shridhar via alejandro)

Alejandro Fernandez 9 years ago
parent
commit
6a36a14deb

+ 13 - 3
ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py

@@ -258,9 +258,19 @@ def select(stack_name, package, version, try_create=True):
           normalized_conf_dir = (os.path.normpath(conf_dir)).strip()
           normalized_current_dir = (os.path.normpath(real_path_of_current_dir)).strip()
           Logger.info("Normalized Conf Dir : {0}, Normalized Current Dir : {1}".format(normalized_conf_dir, normalized_current_dir))
-          if not os.path.isdir(normalized_conf_dir) and os.path.isdir(normalized_current_dir) and normalized_current_dir != normalized_conf_dir:
-            Logger.info("Creating Symlink : {0} -> {1}".format(normalized_conf_dir, normalized_current_dir))
-            os.symlink(normalized_current_dir, normalized_conf_dir)
+          if os.path.isdir(normalized_current_dir) and normalized_current_dir != normalized_conf_dir:
+            if not os.path.isdir(normalized_conf_dir) :
+              os.symlink(normalized_current_dir, normalized_conf_dir)
+              Logger.info("{0} directory doesn't exist. Created Symlink : {1} -> {2}".format(normalized_conf_dir, normalized_conf_dir, normalized_current_dir))
+              return
+            # In case, 'normalized_conf_dir' does have a symlink and it's not the one mentioned in 'PACKAGE_DIRS',
+            # we remove the symlink and make it point to correct symlink.
+            if (os.path.islink(normalized_conf_dir) and os.readlink(normalized_conf_dir) != normalized_current_dir):
+              Logger.info("{0} exists and points to incorrect path {1}".format(normalized_conf_dir, os.readlink(normalized_conf_dir)))
+              os.remove(normalized_conf_dir)
+              Logger.info("Removed existing symlink for {0}".format(normalized_conf_dir))
+              os.symlink(normalized_current_dir, normalized_conf_dir)
+              Logger.info("Created Symlink : {0} -> {1}".format(normalized_conf_dir, normalized_current_dir))
 
 def get_hadoop_conf_dir(force_latest_on_upgrade=False):
   """

+ 39 - 6
ambari-server/src/main/resources/stacks/HDP/2.1/upgrades/nonrolling-upgrade-2.3.xml

@@ -791,36 +791,69 @@
 
     <service name="STORM">
       <component name="NIMBUS">
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
-      </component>
+        <pre-upgrade>
+          <task xsi:type="execute" summary="Removing Storm data from ZooKeeper">
+            <script>scripts/storm_upgrade.py</script>
+            <function>delete_storm_zookeeper_data</function>
+          </task>
+
+          <task xsi:type="execute" summary="Removing local Storm data">
+            <script>scripts/storm_upgrade.py</script>
+            <function>delete_storm_local_data</function>
+          </task>
+        </pre-upgrade>
 
-      <component name="STORM_REST_API">
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
       </component>
 
       <component name="SUPERVISOR">
+        <pre-upgrade>
+          <task xsi:type="execute" summary="Removing local Storm data">
+            <script>scripts/storm_upgrade.py</script>
+            <function>delete_storm_local_data</function>
+          </task>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
       </component>
 
       <component name="STORM_UI_SERVER">
+        <pre-upgrade>
+          <task xsi:type="execute" summary="Removing local Storm data">
+            <script>scripts/storm_upgrade.py</script>
+            <function>delete_storm_local_data</function>
+          </task>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
       </component>
 
       <component name="DRPC_SERVER">
+        <pre-upgrade>
+          <task xsi:type="execute" summary="Removing local Storm data">
+            <script>scripts/storm_upgrade.py</script>
+            <function>delete_storm_local_data</function>
+          </task>
+        </pre-upgrade>
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
+
+        <post-upgrade>
+          <task xsi:type="manual">
+            <message>Please rebuild your topology using the new Storm version dependencies and resubmit it using the newly created jar.</message>
+          </task>
+        </post-upgrade>
       </component>
     </service>
-    
+
     <service name="FLUME">
       <component name="FLUME_HANDLER">
         <upgrade>