Pārlūkot izejas kodu

AMBARI-17375. [RU/EU] According to Atlas run-book, implement upgrade for Atlas component (aonishuk)

Andrew Onishuk 9 gadi atpakaļ
vecāks
revīzija
3283b09c22

+ 5 - 2
ambari-common/src/main/python/resource_management/libraries/functions/constants.py

@@ -20,6 +20,7 @@ limitations under the License.
 
 __all__ = ["Direction", "SafeMode", "StackFeature"]
 
+
 class Direction:
   """
   Stack Upgrade direction
@@ -27,6 +28,7 @@ class Direction:
   UPGRADE = "upgrade"
   DOWNGRADE = "downgrade"
 
+
 class SafeMode:
   """
   Namenode Safe Mode state
@@ -34,7 +36,8 @@ class SafeMode:
   ON = "ON"
   OFF = "OFF"
   UNKNOWN = "UNKNOWN"
-  
+
+
 class StackFeature:
   """
   Stack Feature supported
@@ -68,7 +71,6 @@ class StackFeature:
   ACCUMULO_KERBEROS_USER_AUTH = "accumulo_kerberos_user_auth"
   KNOX_VERSIONED_DATA_DIR = "knox_versioned_data_dir"
   KNOX_SSO_TOPOLOGY = "knox_sso_topology"
-  ATLAS_ROLLING_UPGRADE = "atlas_rolling_upgrade"
   OOZIE_ADMIN_USER = "oozie_admin_user"
   OOZIE_CREATE_HIVE_TEZ_CONFIGS = "oozie_create_hive_tez_configs"
   OOZIE_SETUP_SHARED_LIB = "oozie_setup_shared_lib"
@@ -87,3 +89,4 @@ class StackFeature:
   LOGSEARCH_SUPPORT = "logsearch_support"
   HBASE_HOME_DIRECTORY = "hbase_home_directory"
   ATLAS_RANGER_PLUGIN_SUPPORT = "atlas_ranger_plugin_support"
+  ATLAS_UPGRADE_SUPPORT = "atlas_upgrade_support"

+ 9 - 14
ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py

@@ -27,30 +27,25 @@ from resource_management.libraries.functions import StackFeature
 
 from metadata import metadata
 
-# todo: support rolling upgrade
+
 class AtlasClient(Script):
 
   def get_component_name(self):
     return "atlas-client"
 
-  # ToDo: currently <stack-selector-tool> doesn't contain atlas-client, uncomment this block when
-  # ToDo: atlas-client will be available
-  # def pre_upgrade_restart(self, env, upgrade_type=None):
-  #   import params
-  #   env.set_params(params)
-  #
-  # TODO: Add ATLAS_CONFIG_VERSIONING stack feature and uncomment this code when config versioning for Atlas is supported
-  #   if params.version and check_stack_feature(StackFeature.ATLAS_CONFIG_VERSIONING, params.version):
-  #     conf_select.select(params.stack_name, "atlas", params.version)
-  # TODO: Add ATLAS_CLIENT_ROLLING_UPGRADE stack feature and uncomment this code when rolling upgrade for Atlas client is supported
-  #   if params.version and check_stack_feature(StackFeature.ATLAS_CLIENT_ROLLING_UPGRADE, params.version):
-  #     stack_select.select("atlas-client", params.version)
+  def pre_upgrade_restart(self, env, upgrade_type=None):
+    import params
+    env.set_params(params)
+
+    if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, params.version):
+      conf_select.select(params.stack_name, "atlas", params.version)
+      stack_select.select("atlas-client", params.version)
 
   def install(self, env):
     self.install_packages(env)
     self.configure(env)
 
-  def configure(self, env):
+  def configure(self, env, upgrade_type=None, config_dir=None):
     import params
     env.set_params(params)
     metadata('client')

+ 4 - 6
ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py

@@ -32,6 +32,7 @@ import shutil
 from resource_management.core.logger import Logger
 from setup_ranger_atlas import setup_ranger_atlas
 
+
 class MetadataServer(Script):
 
   def get_component_name(self):
@@ -47,7 +48,7 @@ class MetadataServer(Script):
 
     self.install_packages(env)
 
-  def configure(self, env):
+  def configure(self, env, upgrade_type=None, config_dir=None):
     import params
     env.set_params(params)
     metadata()
@@ -56,11 +57,8 @@ class MetadataServer(Script):
     import params
     env.set_params(params)
 
-    # TODO: Add ATLAS_CONFIG_VERSIONING stack feature and uncomment this code when config versioning for Atlas is supported
-    #if params.version and check_stack_feature(StackFeature.ATLAS_CONFIG_VERSIONING, params.version):
-    #  conf_select.select(params.stack_name, "atlas", params.version)
-
-    if params.version and check_stack_feature(StackFeature.ATLAS_ROLLING_UPGRADE, params.version):
+    if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, params.version):
+      conf_select.select(params.stack_name, "atlas", params.version)
       stack_select.select("atlas-server", params.version)
 
   def start(self, env, upgrade_type=None):

+ 5 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json

@@ -245,6 +245,11 @@
       "name": "atlas_ranger_plugin_support",
       "description": "Atlas Ranger plugin support",
       "min_version": "2.5.0.0"
+    },
+    {
+      "name": "atlas_upgrade_support",
+      "description": "Atlas supports express and rolling upgrades",
+      "min_version": "2.5.0.0"
     }
   ]
 }

+ 0 - 25
ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml

@@ -69,11 +69,6 @@
       <parallel-scheduler/>
       <service-check>false</service-check>
 
-      <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
-      <service name="ATLAS">
-        <component>ATLAS_SERVER</component>
-      </service>
-
       <service name="FLUME">
         <component>FLUME_HANDLER</component>
       </service>
@@ -480,17 +475,6 @@
       </service>
     </group>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
-    <group xsi:type="restart" name="ATLAS" title="Atlas">
-      <service-check>false</service-check>
-      <skippable>true</skippable>
-      <supports-auto-skip-failure>false</supports-auto-skip-failure>
-      <parallel-scheduler/>
-      <service name="ATLAS">
-        <component>ATLAS_SERVER</component>
-      </service>
-    </group>
-
     <group xsi:type="restart" name="OOZIE" title="Oozie">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -1045,14 +1029,5 @@
       </component>
     </service>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
-    <service name="ATLAS">
-      <component name="ATLAS_SERVER">
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
-      </component>
-
-    </service>
   </processing>
 </upgrade>

+ 0 - 10
ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml

@@ -239,16 +239,6 @@
       </service>
     </group>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
-    <group name="ATLAS" title="Atlas">
-      <service-check>false</service-check>
-      <skippable>true</skippable>
-      <supports-auto-skip-failure>false</supports-auto-skip-failure>
-      <service name="ATLAS">
-        <component>ATLAS_SERVER</component>
-      </service>
-    </group>
-
     <group name="OOZIE" title="Oozie">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

+ 0 - 25
ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml

@@ -69,11 +69,6 @@
       <parallel-scheduler/>
       <service-check>false</service-check>
 
-      <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
-      <service name="ATLAS">
-        <component>ATLAS_SERVER</component>
-      </service>
-
       <service name="FLUME">
         <component>FLUME_HANDLER</component>
       </service>
@@ -475,17 +470,6 @@
       </service>
     </group>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
-    <group xsi:type="restart" name="ATLAS" title="Atlas">
-      <service-check>false</service-check>
-      <skippable>true</skippable>
-      <supports-auto-skip-failure>false</supports-auto-skip-failure>
-      <parallel-scheduler/>
-      <service name="ATLAS">
-        <component>ATLAS_SERVER</component>
-      </service>
-    </group>
-
     <group xsi:type="restart" name="OOZIE" title="Oozie">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -1040,14 +1024,5 @@
       </component>
     </service>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
-    <service name="ATLAS">
-      <component name="ATLAS_SERVER">
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
-      </component>
-
-    </service>
   </processing>
 </upgrade>

+ 0 - 10
ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml

@@ -237,16 +237,6 @@
       </service>
     </group>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
-    <group name="ATLAS" title="Atlas">
-      <service-check>false</service-check>
-      <skippable>true</skippable>
-      <supports-auto-skip-failure>false</supports-auto-skip-failure>
-      <service name="ATLAS">
-        <component>ATLAS_SERVER</component>
-      </service>
-    </group>
-
     <group name="OOZIE" title="Oozie">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>

+ 15 - 3
ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml

@@ -69,7 +69,6 @@
       <parallel-scheduler/>
       <service-check>false</service-check>
 
-      <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
       <service name="ATLAS">
         <component>ATLAS_SERVER</component>
       </service>
@@ -485,7 +484,6 @@
       </service>
     </group>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
     <group xsi:type="restart" name="ATLAS" title="Atlas">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -496,6 +494,16 @@
       </service>
     </group>
 
+    <group xsi:type="restart" name="ATLAS_CLIENTS" title="Atlas Clients">
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <supports-auto-skip-failure>true</supports-auto-skip-failure>
+      <parallel-scheduler/>
+      <service name="ATLAS">
+        <component>ATLAS_CLIENT</component>
+      </service>
+    </group>
+
     <group xsi:type="restart" name="OOZIE" title="Oozie">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -1053,7 +1061,6 @@
       </component>
     </service>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
     <service name="ATLAS">
       <component name="ATLAS_SERVER">
         <upgrade>
@@ -1061,6 +1068,11 @@
         </upgrade>
       </component>
 
+      <component name="ATLAS_CLIENT">
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
+      </component>
     </service>
   </processing>
 </upgrade>

+ 23 - 1
ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml

@@ -247,7 +247,6 @@
       </service>
     </group>
 
-    <!-- TODO, Atlas doesn't yet support upgrades and the client doesn't exist in hdp-select. -->
     <group name="ATLAS" title="Atlas">
       <service-check>false</service-check>
       <skippable>true</skippable>
@@ -257,6 +256,15 @@
       </service>
     </group>
 
+    <group name="ATLAS_CLIENTS" title="Atlas Clients">
+      <service-check>false</service-check>
+      <skippable>true</skippable>
+      <supports-auto-skip-failure>true</supports-auto-skip-failure>
+      <service name="ATLAS">
+        <component>ATLAS_CLIENT</component>
+      </service>
+    </group>
+
     <group name="OOZIE" title="Oozie">
       <skippable>true</skippable>
       <supports-auto-skip-failure>false</supports-auto-skip-failure>
@@ -881,5 +889,19 @@
         </upgrade>
       </component>
     </service>
+
+    <service name="ATLAS">
+      <component name="ATLAS_SERVER">
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
+      </component>
+      <component name="ATLAS_CLIENT">
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
+      </component>
+    </service>
+
   </processing>
 </upgrade>