You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2017/07/04 18:22:12 UTC
ambari git commit: AMBARI-21390. Change stack root references in
config during cross-stack upgrade
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-21348 00cc41b94 -> 45608210f
AMBARI-21390. Change stack root references in config during cross-stack upgrade
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/45608210
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/45608210
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/45608210
Branch: refs/heads/branch-feature-AMBARI-21348
Commit: 45608210f44487dc350107438f169bf3d434f47f
Parents: 00cc41b
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Fri Jun 30 21:13:06 2017 +0200
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Tue Jul 4 20:21:22 2017 +0200
----------------------------------------------------------------------
.../ChangeStackRootDirectoryAction.java | 92 +++
.../4.2.5/upgrades/config-upgrade.xml | 118 +++
.../upgrades/nonrolling-upgrade-to-hdp-2.6.xml | 795 +++++++++++++++++++
.../upgrades/nonrolling-upgrade-to-hdp-2.6.xml | 9 +
.../ChangeStackRootDirectoryActionTest.java | 101 +++
5 files changed, 1115 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/45608210/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ChangeStackRootDirectoryAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ChangeStackRootDirectoryAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ChangeStackRootDirectoryAction.java
new file mode 100644
index 0000000..31c4292
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ChangeStackRootDirectoryAction.java
@@ -0,0 +1,92 @@
+/*
+ * 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.serveraction.upgrades;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.inject.Inject;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Replaces references to the old stack root ("/usr/iop") with the new
+ * stack root ("/usr/hdp") during upgrade from BigInsights to HDP.
+ * TODO pass stack root locations as parameters from the upgrade pack
+ */
+public class ChangeStackRootDirectoryAction extends AbstractServerAction {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ChangeStackRootDirectoryAction.class);
+ private static final String OLD_STACK_ROOT = "/usr/iop";
+ private static final String NEW_STACK_ROOT = "/usr/hdp";
+
+ @Inject
+ private Clusters clusters;
+
+ @Override
+ public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext) throws AmbariException, InterruptedException {
+ StringBuilder out = new StringBuilder();
+
+ String msg = String.format("Changing stack root directory references from %s to %s", OLD_STACK_ROOT, NEW_STACK_ROOT);
+ LOG.info(msg);
+ out.append(msg).append(System.lineSeparator());
+
+ String clusterName = getExecutionCommand().getClusterName();
+ Cluster cluster = clusters.getCluster(clusterName);
+
+ for (String configType: cluster.getDesiredConfigs().keySet()) {
+ Config config = cluster.getDesiredConfigByType(configType);
+ String typeMsg = String.format("Checking config type=%s version=%s tag=%s", config.getType(), config.getVersion(), config.getTag());
+ LOG.debug(typeMsg);
+ out.append(typeMsg).append(System.lineSeparator());
+ Map<String, String> properties = config.getProperties();
+ if (!properties.isEmpty()) {
+ Map<String, String> changedProperties = Maps.newHashMap();
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ String key = entry.getKey();
+ String original = entry.getValue();
+ if (original != null) {
+ String replaced = original.replace(OLD_STACK_ROOT, NEW_STACK_ROOT);
+ if (!replaced.equals(original)) {
+ changedProperties.put(key, replaced);
+ String itemMsg = String.format("Changing %s", key);
+ LOG.debug(itemMsg);
+ out.append(itemMsg).append(System.lineSeparator());
+ }
+ }
+ }
+ if (!changedProperties.isEmpty()) {
+ config.updateProperties(changedProperties);
+ config.save();
+ }
+ }
+ }
+
+ return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", out.toString(), "");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/45608210/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/upgrades/config-upgrade.xml
new file mode 100644
index 0000000..540c017
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/upgrades/config-upgrade.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<upgrade-config-changes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <services>
+ <service name="HDFS">
+ <component name="NAMENODE">
+ <changes>
+ <definition xsi:type="configure" id="biginsights_4_2_namenode_update_hadoop_env" summary="Update Hadoop env">
+ <type>hadoop-env</type>
+ <replace key="content" find="export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:/usr/iop/current/hadoop-client/lib/native/Linux-amd64-64" replace-with="export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:/usr/hdp/current/hadoop-client/lib/native" />
+ <replace key="content" find="export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}${JAVA_JDBC_LIBS}:${MAPREDUCE_LIBS}" replace-with="export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}${JAVA_JDBC_LIBS}:${MAPREDUCE_LIBS} if [ -d "/usr/lib/hadoop-lzo" ]; then export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:/usr/lib/hadoop-lzo/lib/* export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:/usr/lib/hadoop-lzo/lib/native fi"/>
+ </definition>
+ </changes>
+ </component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component name="HISTORYSERVER">
+ <changes>
+ <definition xsi:type="configure" id="biginsights_4_2_mapreduce_application_framework_patch" summary="Update MapReduce2 configurations">
+ <type>mapred-site</type>
+ <set key="mapreduce.application.framework.path" value="/hdp/apps/${hdp.version}/mapreduce/mapreduce.tar.gz#mr-framework"/>
+ </definition>
+ </changes>
+ </component>
+ </service>
+
+ <service name="HIVE">
+ <component name="HIVE_SERVER">
+ <changes>
+ <definition xsi:type="configure" id="biginsights_4_2_0_0_hive_server_configure_authentication" summary="Configuring hive authentication">
+ <type>hive-site</type>
+ <transfer operation="delete" delete-key="hive.server2.authentication.ldap.url" if-key="hive.server2.authentication" if-type="hive-site" if-value="NONE"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.ldap.baseDN" if-key="hive.server2.authentication" if-type="hive-site" if-value="NONE"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.pam.services" if-key="hive.server2.authentication" if-type="hive-site" if-value="NONE"/>
+ <transfer operation="delete" delete-key="hive.server2.custom.authentication.class" if-key="hive.server2.authentication" if-type="hive-site" if-value="NONE"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.kerberos.keytab" if-key="hive.server2.authentication" if-type="hive-site" if-value="NONE"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.kerberos.principal" if-key="hive.server2.authentication" if-type="hive-site" if-value="NONE"/>
+
+ <transfer operation="delete" delete-key="hive.server2.authentication.kerberos.keytab" if-key="hive.server2.authentication" if-type="hive-site" if-value="ldap"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.kerberos.principal" if-key="hive.server2.authentication" if-type="hive-site" if-value="ldap"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.pam.services" if-key="hive.server2.authentication" if-type="hive-site" if-value="ldap"/>
+ <transfer operation="delete" delete-key="hive.server2.custom.authentication.class" if-key="hive.server2.authentication" if-type="hive-site" if-value="ldap"/>
+
+ <transfer operation="delete" delete-key="hive.server2.authentication.ldap.url" if-key="hive.server2.authentication" if-type="hive-site" if-value="kerberos"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.ldap.baseDN" if-key="hive.server2.authentication" if-type="hive-site" if-value="kerberos"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.pam.services" if-key="hive.server2.authentication" if-type="hive-site" if-value="kerberos"/>
+ <transfer operation="delete" delete-key="hive.server2.custom.authentication.class" if-key="hive.server2.authentication" if-type="hive-site" if-value="kerberos"/>
+
+ <transfer operation="delete" delete-key="hive.server2.authentication.ldap.url" if-key="hive.server2.authentication" if-type="hive-site" if-value="pam"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.ldap.baseDN" if-key="hive.server2.authentication" if-type="hive-site" if-value="pam"/>
+ <transfer operation="delete" delete-key="hive.server2.custom.authentication.class" if-key="hive.server2.authentication" if-type="hive-site" if-value="pam"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.kerberos.keytab" if-key="hive.server2.authentication" if-type="hive-site" if-value="pam"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.kerberos.principal" if-key="hive.server2.authentication" if-type="hive-site" if-value="pam"/>
+
+ <transfer operation="delete" delete-key="hive.server2.authentication.ldap.url" if-key="hive.server2.authentication" if-type="hive-site" if-value="custom"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.ldap.baseDN" if-key="hive.server2.authentication" if-type="hive-site" if-value="custom"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.pam.services" if-key="hive.server2.authentication" if-type="hive-site" if-value="custom"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.kerberos.keytab" if-key="hive.server2.authentication" if-type="hive-site" if-value="custom"/>
+ <transfer operation="delete" delete-key="hive.server2.authentication.kerberos.principal" if-key="hive.server2.authentication" if-type="hive-site" if-value="custom"/>
+ </definition>
+
+ </changes>
+ </component>
+
+ <component name="WEBHCAT_SERVER">
+ <changes>
+ <definition xsi:type="configure" id="biginsights_4_2_webhcat_server_update_environment_configurations" summary="Update Hadoop home">
+ <type>webhcat-env</type>
+ <replace key="content" find="export HADOOP_HOME={{hadoop_home}}" replace-with="export HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}" />
+ </definition>
+
+ <definition xsi:type="configure" id="biginsights_4_2_webhcat_server_update_configurations" summary="Updating Configuration Paths">
+ <type>webhcat-site</type>
+ <replace key="templeton.jar" find="/usr/iop/current/hive-webhcat" replace-with="/usr/hdp/${hdp.version}/hive"/>
+ <replace key="templeton.libjars" find="/usr/iop/current/zookeeper-client" replace-with="/usr/hdp/${hdp.version}/zookeeper"/>
+ <replace key="templeton.hadoop" find="/usr/iop/current/hadoop-client" replace-with="/usr/hdp/${hdp.version}/hadoop"/>
+ <replace key="templeton.hcat" find="/usr/iop/current/hive-client" replace-with="/usr/hdp/${hdp.version}/hive"/>
+ </definition>
+ </changes>
+ </component>
+ </service>
+
+ <service name="OOZIE">
+ <component name="OOZIE_SERVER">
+ <changes>
+ <definition xsi:type="configure" id="biginsights_4_2_oozie_server_update_configurations" Summary="Updating oozie-site configurations">
+ <condition type="oozie-site" key="oozie.services" value="org.apache.oozie.service.SchedulerService, org.apache.oozie.service.InstrumentationService, org.apache.oozie.service.CallableQueueService, org.apache.oozie.service.UUIDService, org.apache.oozie.service.ELService, org.apache.oozie.service.AuthorizationService, org.apache.oozie.service.UserGroupInformationService, org.apache.oozie.service.HadoopAccessorService, org.apache.oozie.service.JobsConcurrencyService, org.apache.oozie.service.URIHandlerService, org.apache.oozie.service.MemoryLocksService, org.apache.oozie.service.DagXLogInfoService, org.apache.oozie.service.SchemaService, org.apache.oozie.service.LiteWorkflowAppService, org.apache.oozie.service.JPAService, org.apache.oozie.service.StoreService, org.apache.oozie.service.SLAStoreService, org.apache.oozie.service.DBLiteWorkflowStoreService, org.apache.oozie.service.CallbackSer
vice, org.apache.oozie.service.ActionService, org.apache.oozie.service.ShareLibService, org.apache.oozie.service.ActionCheckerService, org.apache.oozie.service.RecoveryService, org.apache.oozie.service.PurgeService, org.apache.oozie.service.CoordinatorEngineService, org.apache.oozie.service.BundleEngineService, org.apache.oozie.service.DagEngineService, org.apache.oozie.service.CoordMaterializeTriggerService, org.apache.oozie.service.StatusTransitService, org.apache.oozie.service.PauseTransitService, org.apache.oozie.service.GroupsService, org.apache.oozie.service.ProxyUserService, org.apache.oozie.service.XLogStreamingService, org.apache.oozie.service.JvmPauseMonitorService">
+ <type>oozie-site</type>
+ <key>oozie.services</key>
+ <value>org.apache.oozie.service.SchedulerService, org.apache.oozie.service.InstrumentationService, org.apache.oozie.service.CallableQueueService, org.apache.oozie.service.UUIDService, org.apache.oozie.service.ELService, org.apache.oozie.service.AuthorizationService, org.apache.oozie.service.UserGroupInformationService, org.apache.oozie.service.HadoopAccessorService, org.apache.oozie.service.JobsConcurrencyService, org.apache.oozie.service.URIHandlerService, org.apache.oozie.service.MemoryLocksService, org.apache.oozie.service.DagXLogInfoService, org.apache.oozie.service.SchemaService, org.apache.oozie.service.LiteWorkflowAppService, org.apache.oozie.service.JPAService, org.apache.oozie.service.StoreService, org.apache.oozie.service.SLAStoreService, org.apache.oozie.service.DBLiteWorkflowStoreService, org.apache.oozie.service.CallbackService, org.apache.oozie.service.ActionService,
org.apache.oozie.service.ShareLibService, org.apache.oozie.service.ActionCheckerService, org.apache.oozie.service.RecoveryService, org.apache.oozie.service.PurgeService, org.apache.oozie.service.CoordinatorEngineService, org.apache.oozie.service.BundleEngineService, org.apache.oozie.service.DagEngineService, org.apache.oozie.service.CoordMaterializeTriggerService, org.apache.oozie.service.StatusTransitService, org.apache.oozie.service.PauseTransitService, org.apache.oozie.service.GroupsService, org.apache.oozie.service.ProxyUserService, org.apache.oozie.service.XLogStreamingService, org.apache.oozie.service.JvmPauseMonitorService, org.apache.oozie.service.SparkConfigurationService</value>
+ </condition>
+ </definition>
+ <definition xsi:type="configure" id="biginsights_4_2_oozie_server_update_environment_configurations" summary="Update oozie env">
+ <type>oozie-env</type>
+ <replace key="content" find="export CATALINA_BASE=${CATALINA_BASE:-{{oozie_server_dir}}}" replace-with="export CATALINA_BASE={{oozie_server_dir}}" />
+ </definition>
+ </changes>
+ </component>
+ </service>
+ </services>
+</upgrade-config-changes>
http://git-wip-us.apache.org/repos/asf/ambari/blob/45608210/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/upgrades/nonrolling-upgrade-to-hdp-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/upgrades/nonrolling-upgrade-to-hdp-2.6.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/upgrades/nonrolling-upgrade-to-hdp-2.6.xml
new file mode 100644
index 0000000..ac0f767
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/upgrades/nonrolling-upgrade-to-hdp-2.6.xml
@@ -0,0 +1,795 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+
+<upgrade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="upgrade-pack.xsd">
+ <target>2.6.*.*</target>
+ <target-stack>HDP-2.6</target-stack>
+ <type>NON_ROLLING</type>
+ <!-- TODO
+ <downgrade-allowed>false</downgrade-allowed>
+ -->
+ <prerequisite-checks>
+ <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
+ <check>org.apache.ambari.server.checks.JavaVersionCheck</check>
+ <configuration>
+ <!-- Configuration properties for all pre-reqs including required pre-reqs -->
+ <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
+ <property name="min-failure-stack-version">BigInsights-4.1</property>
+ </check-properties>
+ <check-properties name="org.apache.ambari.server.checks.JavaVersionCheck">
+ <property name="java-version">1.8</property>
+ </check-properties>
+ </configuration>
+ </prerequisite-checks>
+
+ <order>
+ <!-- NOT SUPPORTED AT THIS TIME
+ <group xsi:type="stop" name="STOP_HIGH_LEVEL_SERVICE_COMPONENTS" title="Stop Components for High-Level Services">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <service-check>false</service-check>
+ <parallel-scheduler/>
+
+ <service name="FLUME">
+ <component>FLUME_HANDLER</component>
+ </service>
+
+ <service name="KNOX">
+ <component>KNOX_GATEWAY</component>
+ </service>
+
+ <service name="KAFKA">
+ <component>KAFKA_BROKER</component>
+ </service>
+
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+
+ <service name="SPARK">
+ <component>SPARK_JOBHISTORYSERVER</component>
+ <component>SPARK_THRIFTSERVER</component>
+ </service>
+
+ <service name="HIVE">
+ <component>WEBHCAT_SERVER</component>
+ <component>HIVE_SERVER</component>
+ <component>HIVE_METASTORE</component>
+ </service>
+
+ <service name="YARN">
+ <component>NODEMANAGER</component>
+ <component>RESOURCEMANAGER</component>
+ <component>APP_TIMELINE_SERVER</component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component>HISTORYSERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="Backups" title="Perform Backups">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Backup Oozie Database">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Oozie Server database referenced by the Oozie server located on {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HIVE" component="HIVE_METASTORE" title="Backup Hive Metastore">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Hive Metastore database referenced by the Hive Metastore service(s) located on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="KNOX" component="KNOX_GATEWAY" title="Backup Knox Data">
+ <task xsi:type="manual">
+ <message>Before continuing, please backup the Knox data. E.g., "cp -RL /usr/iop/current/knox-server/data/* ~/knox_backup/" on the following host(s): {{hosts.all}}.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HBASE" component="HBASE_MASTER" title="Snapshot HBASE">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/hbase_upgrade.py</script>
+ <function>snapshot</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Prepare HDFS">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>prepare_express_upgrade</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="stop" name="STOP_LOW_LEVEL_SERVICE_COMPONENTS" title="Stop Components for Core Services">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <service-check>false</service-check>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+
+ <service name="HBASE">
+ <component>HBASE_REGIONSERVER</component>
+ <component>HBASE_MASTER</component>
+ <component>HBASE_REST_SERVER</component>
+ </service>
+
+ <service name="HDFS">
+ <component>DATANODE</component>
+ <component>NAMENODE</component>
+ <component>SECONDARY_NAMENODE</component>
+ <component>ZKFC</component>
+ <component>JOURNALNODE</component>
+ <component>NFS_GATEWAY</component>
+ </service>
+
+ <service name="ZOOKEEPER">
+ <component>ZOOKEEPER_SERVER</component>
+ </service>
+ </group>
+ -->
+
+ <!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
+ <execute-stage title="Update Target Stack">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="CHANGE_STACK_ROOT_DIRECTORY_REFERENCES" title="Change stack root directory references">
+ <direction>UPGRADE</direction>
+ <skippable>false</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <execute-stage title="Change stack root directory references">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ChangeStackRootDirectoryAction"/>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="Upgrade service configs" title="Upgrade service configs">
+ <direction>UPGRADE</direction> <!-- prevent config changes on downgrade -->
+ <skippable>true</skippable> <!-- May fix configuration problems manually -->
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <!-- HDFS -->
+ <execute-stage service="HDFS" component="NAMENODE" title="Apply config changes for Hadoop NameNode">
+ <task xsi:type="configure" id="biginsights_4_2_namenode_update_hadoop_env" />
+ </execute-stage>
+
+ <!-- YARN -->
+ <execute-stage service="MAPREDUCE2" component="HISTORYSERVER" title="Apply config changes for HistoryServer">
+ <task xsi:type="configure" id="biginsights_4_2_mapreduce_application_framework_patch" />
+ </execute-stage>
+
+ <!-- HIVE -->
+ <execute-stage service="HIVE" component="HIVE_SERVER" title="Apply config changes for Hive Server">
+ <task xsi:type="configure" id="biginsights_4_2_0_0_hive_server_configure_authentication"/>
+ </execute-stage>
+ <execute-stage service="HIVE" component="WEBHCAT_SERVER" title="Apply config changes for Hive WebHCat server">
+ <task xsi:type="configure" id="biginsights_4_2_webhcat_server_update_environment_configurations" />
+ </execute-stage>
+ <execute-stage service="HIVE" component="WEBHCAT_SERVER" title="Apply config changes for Hive WebHCat server">
+ <task xsi:type="configure" id="biginsights_4_2_webhcat_server_update_configurations" />
+ </execute-stage>
+
+ <!-- OOZIE -->
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie server">
+ <task xsi:type="configure" id="biginsights_4_2_oozie_server_update_configurations" />
+ </execute-stage>
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Apply config changes for Oozie server">
+ <task xsi:type="configure" id="biginsights_4_2_oozie_server_update_environment_configurations" />
+ </execute-stage>
+ </group>
+
+
+ <!--
+ After processing this group, the user-specified Kerberos descriptor will be updated to work with
+ the new stack-level Kerberos descriptor.
+ -->
+ <group xsi:type="cluster" name="UPDATE_KERBEROS_DESCRIPTORS" title="Update Kerberos Descriptors">
+ <condition xsi:type="security" type="kerberos"/>
+ <execute-stage title="Update the user-specified Kerberos descriptor">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpgradeUserKerberosDescriptor"/>
+ </execute-stage>
+ </group>
+
+ <!--
+ Invoke "hdp-select set all" to change any components we may have missed
+ that are installed on the hosts but not known by Ambari.
+ -->
+ <group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All Hosts">
+ <scope>COMPLETE</scope>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage title="Update stack to {{version}}">
+ <task xsi:type="execute">
+ <script>scripts/ru_set_all.py</script>
+ <function>actionexecute</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <!-- Now, restart all of the services. -->
+ <group xsi:type="restart" name="ZOOKEEPER" title="ZooKeeper">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="ZOOKEEPER">
+ <component>ZOOKEEPER_SERVER</component>
+ <component>ZOOKEEPER_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HDFS" title="HDFS">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HDFS">
+ <component>JOURNALNODE</component>
+ <component>ZKFC</component>
+ <component>NAMENODE</component>
+ <component>SECONDARY_NAMENODE</component>
+ <component>NFS_GATEWAY</component>
+ <component>HDFS_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HDFS_DATANODES" title="HDFS DataNodes">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="HDFS">
+ <component>DATANODE</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="HDFS_LEAVE_SAFEMODE" title="HDFS - Wait to leave Safemode">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Wait to leave Safemode">
+ <task xsi:type="execute" hosts="all">
+ <summary>Wait for NameNode to leave Safemode</summary>
+ <script>scripts/namenode.py</script>
+ <function>wait_for_safemode_off</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="KAFKA" title="Kafka">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="KAFKA">
+ <component>KAFKA_BROKER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="YARN_AND_MAPR" title="YARN and MapReduce2">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+
+ <service name="MAPREDUCE2">
+ <component>HISTORYSERVER</component>
+ <component>MAPREDUCE2_CLIENT</component>
+ </service>
+
+ <service name="YARN">
+ <component>APP_TIMELINE_SERVER</component>
+ <component>RESOURCEMANAGER</component>
+ <component>YARN_CLIENT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="YARN_NODEMANAGERS" title="YARN NodeManagers">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+
+ <service name="YARN">
+ <component>NODEMANAGER</component>
+ </service>
+ </group>
+
+ <group xsi:type="cluster" name="START_YARN_QUEUES" title="Start YARN Queues">
+ <direction>UPGRADE</direction>
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+
+ <execute-stage service="YARN" component="RESOURCEMANAGER" title="Start YARN Queues">
+ <condition xsi:type="config" type="yarn-site" property="yarn.resourcemanager.work-preserving-recovery.enabled" value="true" comparison="not-equals"/>
+ <task xsi:type="manual">
+ <message>Before continuing, please start all YARN queues.</message>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="HBASE" title="HBASE">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HBASE">
+ <component>HBASE_MASTER</component>
+ <component>HBASE_REGIONSERVER</component>
+ <component>HBASE_CLIENT</component>
+ <component>HBASE_REST_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="CLIENTS" title="Pig, Sqoop Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="PIG">
+ <component>PIG</component>
+ </service>
+
+ <service name="SQOOP">
+ <component>SQOOP</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK_1" title="All Service Checks" xsi:type="service-check">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <priority>
+ <service>ZOOKEEPER</service>
+ <service>HDFS</service>
+ <service>KAFKA</service>
+ <service>YARN</service>
+ <service>MAPREDUCE2</service>
+ <service>HBASE</service>
+ </priority>
+ </group>
+
+ <!-- Slider must be upgraded before higher-level apps that need to run apps on Slider, such as Hive. -->
+ <group xsi:type="restart" name="SLIDER" title="Slider">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="SLIDER">
+ <component>SLIDER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HIVE_MASTERS" title="Hive Masters">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <!-- Must be ran sequentially because Hive Metastore upgrades the schema and Hive Server copies tarballs. -->
+ <parallel-scheduler>
+ <max-degree-of-parallelism>1</max-degree-of-parallelism>
+ </parallel-scheduler>
+ <service name="HIVE">
+ <component>HIVE_METASTORE</component>
+ <component>HIVE_SERVER</component>
+ <component>WEBHCAT_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="HIVE_CLIENTS" title="Hive Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="HIVE">
+ <component>HIVE_CLIENT</component>
+ <component>HCAT</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="SPARK" title="Spark">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="SPARK">
+ <component>SPARK_JOBHISTORYSERVER</component>
+ <component>SPARK_THRIFTSERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="SPARK_CLIENTS" title="Spark Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="SPARK">
+ <component>SPARK_CLIENT</component>
+ </service>
+ </group>
+
+ <!-- Upgrade Oozie DB only on Upgrade direction, and always create a new ShareLib. -->
+ <group name="UPGRADE_OOZIE" title="Upgrade Oozie Database">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <execute-stage service="OOZIE" component="OOZIE_SERVER" title="Upgrade Oozie Database">
+ <task xsi:type="execute" hosts="any">
+ <summary>Upgrading the database and creating a new sharelib</summary>
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>upgrade_oozie_database_and_sharelib</function>
+ </task>
+ </execute-stage>
+ </group>
+
+ <group xsi:type="restart" name="OOZIE" title="Oozie">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <parallel-scheduler/>
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="OOZIE_CLIENTS" title="Oozie Clients">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="OOZIE">
+ <component>OOZIE_CLIENT</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK_2" title="All Service Checks" xsi:type="service-check">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <priority>
+ <service>SLIDER</service>
+ <service>HIVE</service>
+ <service>SPARK</service>
+ <service>OOZIE</service>
+ </priority>
+ </group>
+
+ <group xsi:type="restart" name="KNOX" title="Knox">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="KNOX">
+ <component>KNOX_GATEWAY</component>
+ </service>
+ </group>
+
+ <group xsi:type="restart" name="FLUME" title="Flume">
+ <service-check>false</service-check>
+ <skippable>true</skippable>
+ <parallel-scheduler/>
+ <service name="FLUME">
+ <component>FLUME_HANDLER</component>
+ </service>
+ </group>
+
+ <group name="SERVICE_CHECK_3" title="All Service Checks" xsi:type="service-check">
+ <direction>UPGRADE</direction>
+ <skippable>true</skippable>
+ <priority>
+ <service>KNOX</service>
+ <service>FLUME</service>
+ </priority>
+ </group>
+
+ <group xsi:type="cluster" name="FINALIZE_PRE_CHECK" title="Finalize {{direction.text.proper}} Pre-Check">
+ <direction>UPGRADE</direction>
+
+ <execute-stage title="Check Component Versions">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ComponentVersionCheckAction" />
+ </execute-stage>
+ </group>
+
+ <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
+ <skippable>true</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+
+ <execute-stage title="Confirm Finalize">
+ <direction>UPGRADE</direction>
+ <task xsi:type="manual">
+ <message>Please confirm you are ready to finalize.</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HBASE" component="HBASE_MASTER" title="Delete HBase snapshots">
+ <direction>UPGRADE</direction>
+ <task xsi:type="manual">
+ <message>You can now remove any HBase snapshots which were created at the beginning of the upgrade. To see existing snapshots, use the following HBase shell command:</message>
+ <message>hbase> list_snapshots</message>
+ <message>Once you have found an existing snapshot which you would like to remove, you can use the following command:</message>
+ <message>hbase> delete_snapshot 'snapshotName'</message>
+ </task>
+ </execute-stage>
+
+ <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
+ <task xsi:type="execute" hosts="master">
+ <script>scripts/namenode.py</script>
+ <function>finalize_non_rolling_upgrade</function>
+ </task>
+ </execute-stage>
+
+ <execute-stage title="Save Cluster State">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FinalizeUpgradeAction">
+ </task>
+ </execute-stage>
+ </group>
+ </order>
+
+ <processing>
+ <service name="ZOOKEEPER">
+ <component name="ZOOKEEPER_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ZOOKEEPER_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HDFS">
+ <component name="NAMENODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="DATANODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HDFS_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="JOURNALNODE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="ZKFC">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="NFS_GATEWAY">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component name="HISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="MAPREDUCE2_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="YARN">
+ <component name="APP_TIMELINE_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="RESOURCEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="NODEMANAGER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="YARN_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KAFKA">
+ <component name="KAFKA_BROKER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HBASE">
+ <component name="HBASE_MASTER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HBASE_REGIONSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HBASE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HBASE_REST_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="PIG">
+ <component name="PIG">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SQOOP">
+ <component name="SQOOP">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="HIVE">
+ <component name="HIVE_METASTORE">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HIVE_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="WEBHCAT_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HIVE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="HCAT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SPARK">
+ <component name="SPARK_JOBHISTORYSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ <component name="SPARK_THRIFTSERVER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ <component name="SPARK_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="OOZIE">
+ <component name="OOZIE_SERVER">
+ <pre-upgrade>
+ <!-- It is extremely important that both of these tasks run on the exact same host. Hence, pick the first alphabetically. -->
+ <task xsi:type="configure_function" hosts="first" />
+
+ <task xsi:type="execute" hosts="first" sequential="true">
+ <summary>Upgrading the Oozie database and creating a new sharelib</summary>
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>upgrade_oozie_database_and_sharelib</function>
+ </task>
+ </pre-upgrade>
+
+ <pre-downgrade>
+ <task xsi:type="execute" hosts="any" sequential="true">
+ <summary>Create a new sharelib</summary>
+ <script>scripts/oozie_server_upgrade.py</script>
+ <function>create_sharelib</function>
+ </task>
+ </pre-downgrade>
+
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+
+ <component name="OOZIE_CLIENT">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="KNOX">
+ <component name="KNOX_GATEWAY">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="SLIDER">
+ <component name="SLIDER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+
+ <service name="FLUME">
+ <component name="FLUME_HANDLER">
+ <upgrade>
+ <task xsi:type="restart-task"/>
+ </upgrade>
+ </component>
+ </service>
+ </processing>
+</upgrade>
http://git-wip-us.apache.org/repos/asf/ambari/blob/45608210/ambari-server/src/main/resources/stacks/BigInsights/4.2/upgrades/nonrolling-upgrade-to-hdp-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/upgrades/nonrolling-upgrade-to-hdp-2.6.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2/upgrades/nonrolling-upgrade-to-hdp-2.6.xml
index e8a1e33..ac0f767 100644
--- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/upgrades/nonrolling-upgrade-to-hdp-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2/upgrades/nonrolling-upgrade-to-hdp-2.6.xml
@@ -159,6 +159,15 @@
</execute-stage>
</group>
+ <group xsi:type="cluster" name="CHANGE_STACK_ROOT_DIRECTORY_REFERENCES" title="Change stack root directory references">
+ <direction>UPGRADE</direction>
+ <skippable>false</skippable>
+ <supports-auto-skip-failure>false</supports-auto-skip-failure>
+ <execute-stage title="Change stack root directory references">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ChangeStackRootDirectoryAction"/>
+ </execute-stage>
+ </group>
+
<group xsi:type="cluster" name="Upgrade service configs" title="Upgrade service configs">
<direction>UPGRADE</direction> <!-- prevent config changes on downgrade -->
<skippable>true</skippable> <!-- May fix configuration problems manually -->
http://git-wip-us.apache.org/repos/asf/ambari/blob/45608210/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ChangeStackRootDirectoryActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ChangeStackRootDirectoryActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ChangeStackRootDirectoryActionTest.java
new file mode 100644
index 0000000..ceac632
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ChangeStackRootDirectoryActionTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.serveraction.upgrades;
+
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.powermock.api.easymock.PowerMock.verifyAll;
+
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.actionmanager.ExecutionCommandWrapper;
+import org.apache.ambari.server.actionmanager.HostRoleCommand;
+import org.apache.ambari.server.agent.ExecutionCommand;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.DesiredConfig;
+import org.junit.Test;
+
+import com.google.common.collect.Maps;
+import com.google.inject.Injector;
+
+public class ChangeStackRootDirectoryActionTest {
+
+ @Test
+ public void testExecute() throws Exception {
+ String clusterName = "c1";
+ String configType = "cluster-env";
+
+ Injector injector = createNiceMock(Injector.class);
+ Clusters clusters = createNiceMock(Clusters.class);
+ Cluster cluster = createNiceMock(Cluster.class);
+
+ Map<String, String> commandParams = Maps.newHashMap();
+ commandParams.put("clusterName", clusterName);
+
+ ExecutionCommand executionCommand = new ExecutionCommand();
+ executionCommand.setCommandParams(commandParams);
+ executionCommand.setClusterName(clusterName);
+
+ HostRoleCommand hrc = createNiceMock(HostRoleCommand.class);
+ expect(hrc.getExecutionCommandWrapper()).andReturn(new ExecutionCommandWrapper(executionCommand));
+
+ // it's difficult to set up a real ConfigImpl, so use a mock
+ Config clusterEnv = createNiceMock(Config.class);
+ expect(clusterEnv.getType()).andReturn(configType).anyTimes();
+
+ Map<String, String> originalProperties = Maps.newHashMap();
+ originalProperties.put("mapreduce_tar_source", "/usr/iop/current/hadoop-client/mapreduce.tar.gz");
+ originalProperties.put("pig_tar_destination_folder", "hdfs:///iop/apps/{{ stack_version }}/pig/");
+ originalProperties.put("pig_tar_source", "/usr/iop/current/pig-client/pig.tar.gz");
+ expect(clusterEnv.getProperties()).andReturn(originalProperties).anyTimes();
+
+ // this is the crux of the test
+ Map<String, String> updatedProperties = Maps.newHashMap();
+ updatedProperties.put("mapreduce_tar_source", "/usr/hdp/current/hadoop-client/mapreduce.tar.gz");
+ updatedProperties.put("pig_tar_source", "/usr/hdp/current/pig-client/pig.tar.gz");
+ clusterEnv.updateProperties(updatedProperties); expectLastCall();
+
+ Map<String, DesiredConfig> desiredConfigs = Collections.singletonMap(configType, createNiceMock(DesiredConfig.class));
+ expect(cluster.getDesiredConfigs()).andReturn(desiredConfigs);
+ expect(cluster.getDesiredConfigByType(configType)).andReturn(clusterEnv).atLeastOnce();
+ expect(clusters.getCluster(clusterName)).andReturn(cluster).anyTimes();
+ expect(injector.getInstance(Clusters.class)).andReturn(clusters).atLeastOnce();
+
+ ChangeStackRootDirectoryAction underTest = new ChangeStackRootDirectoryAction();
+ underTest.setExecutionCommand(executionCommand);
+ underTest.setHostRoleCommand(hrc);
+
+ Field clustersField = ChangeStackRootDirectoryAction.class.getDeclaredField("clusters");
+ clustersField.setAccessible(true);
+ clustersField.set(underTest, clusters);
+
+ replay(injector, clusters, cluster, clusterEnv, hrc);
+
+ ConcurrentMap<String, Object> emptyMap = Maps.newConcurrentMap();
+ underTest.execute(emptyMap);
+
+ verifyAll();
+ }
+}