This is an automated email from the ASF dual-hosted git repository. ncole pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 3a5177f [AMBARI-24687] Upgrade Pack Should Allow Source Information (#2375) 3a5177f is described below commit 3a5177f1c11e980f752ec7444eb98d24d178e1f6 Author: ncole <nc...@hortonworks.com> AuthorDate: Wed Sep 26 08:01:38 2018 -0400 [AMBARI-24687] Upgrade Pack Should Allow Source Information (#2375) --- .../ambari/server/state/stack/UpgradePack.java | 35 +++- ambari-server/src/main/resources/upgrade-pack.xsd | 10 +- .../HDP/2.2.0/upgrades/upgrade_with_source.xml | 220 +++++++++++++++++++++ 3 files changed, 257 insertions(+), 8 deletions(-) diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java index 25778ee..bc24c78 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java @@ -68,6 +68,13 @@ public class UpgradePack { */ private String name; + @XmlElement(name="source") + private String source; + + @XmlElement(name="source-stack") + private String sourceStack; + + @XmlElement(name="target") private String target; @@ -140,6 +147,21 @@ public class UpgradePack { public void setName(String name) { this.name = name; } + + /** + * @return the source version for the upgrade pack + */ + public String getSource() { + return source; + } + + /** + * @return the source stack + */ + public String getSourceStack() { + return sourceStack; + } + /** * @return the target version for the upgrade pack */ @@ -148,6 +170,13 @@ public class UpgradePack { } /** + * @return the target stack + */ + public String getTargetStack() { + return targetStack; + } + + /** * @return the type of upgrade, e.g., "ROLLING" or "NON_ROLLING" */ public UpgradeType getType() { @@ -262,12 +291,6 @@ public class UpgradePack { return intermediateStacks; } - /** - * @return the target stack, or {@code null} if the upgrade is within the same stack - */ - public String getTargetStack() { - return targetStack; - } /** * Gets whether skippable components that failed are automatically skipped. diff --git a/ambari-server/src/main/resources/upgrade-pack.xsd b/ambari-server/src/main/resources/upgrade-pack.xsd index 5dbadc8..e936ab4 100644 --- a/ambari-server/src/main/resources/upgrade-pack.xsd +++ b/ambari-server/src/main/resources/upgrade-pack.xsd @@ -463,8 +463,14 @@ <xs:complexType> <xs:sequence> - <xs:element name="target" type="xs:string" /> - <xs:element name="target-stack" type="xs:string" /> + <xs:choice> + <xs:element name="source" type="xs:string" /> + <xs:element name="target" type="xs:string" /> + </xs:choice> + <xs:choice> + <xs:element name="source-stack" type="xs:string" /> + <xs:element name="target-stack" type="xs:string" /> + </xs:choice> <xs:element name="skip-failures" minOccurs="0" type="xs:boolean" /> <xs:element name="skip-service-check-failures" minOccurs="0" type="xs:boolean" /> <xs:element name="downgrade-allowed" minOccurs="0" type="xs:boolean" /> diff --git a/ambari-server/src/test/resources/stacks/HDP/2.2.0/upgrades/upgrade_with_source.xml b/ambari-server/src/test/resources/stacks/HDP/2.2.0/upgrades/upgrade_with_source.xml new file mode 100644 index 0000000..c993a29 --- /dev/null +++ b/ambari-server/src/test/resources/stacks/HDP/2.2.0/upgrades/upgrade_with_source.xml @@ -0,0 +1,220 @@ +<?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 xsi:noNamespaceSchemaLocation="upgrade-pack.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <source>2.2.*</source> + <source-stack>HDP-2.2.0</source-stack> + <type>ROLLING</type> + <prerequisite-checks> + <check>org.apache.ambari.server.checks.HiveMultipleMetastoreCheck</check> + <check>org.apache.ambari.server.checks.MapReduce2JobHistoryStatePreservingCheck</check> + <check>org.apache.ambari.server.checks.SecondaryNamenodeDeletedCheck</check> + <check>org.apache.ambari.server.checks.ServicesMapReduceDistributedCacheCheck</check> + <check>org.apache.ambari.server.checks.ServicesNamenodeHighAvailabilityCheck</check> + <check>org.apache.ambari.server.checks.ServicesNamenodeTruncateCheck</check> + <check>org.apache.ambari.server.checks.ServicesTezDistributedCacheCheck</check> + <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check> + <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check> + <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check> + </prerequisite-checks> + <order> + <group xsi:type="cluster" name="PRE_CLUSTER" title="Pre {{direction.text.proper}}"> + <execute-stage title="Confirm 1"> + <task xsi:type="manual"> + <message>Foo</message> + </task> + </execute-stage> + <execute-stage service="HDFS" component="NAMENODE" title="Pre Upgrade HIVE"> + <task xsi:type="manual"> + <message>Back stuff up.</message> + </task> + </execute-stage> + <execute-stage service="HDFS" component="NAMENODE" title="Finalize HDFS"> + <task xsi:type="execute"> + <script>foo</script> + <function>list</function> + </task> + </execute-stage> + <execute-stage title="Confirm 2"> + <task xsi:type="manual"> + <message>Goo</message> + </task> + </execute-stage> + </group> + + <group name="ZOOKEEPER" title="Zookeeper"> + <skippable>true</skippable> + <allow-retry>false</allow-retry> + <service name="ZOOKEEPER"> + <component>ZOOKEEPER_SERVER</component> + <component>ZOOKEEPER_CLIENT</component> + </service> + </group> + + <group name="CORE_MASTER" title="Core Masters"> + <service name="HDFS"> + <component>JOURNALNODE</component> + <component>NAMENODE</component> + </service> + <service name="YARN"> + <component>RESOURCEMANAGER</component> + </service> + </group> + + <group name="CORE_SLAVES" title="Core Slaves" xsi:type="colocated"> + <skippable>true</skippable> <!-- set skippable for test --> + <allow-retry>false</allow-retry> <!-- set no retry for test --> + <service name="HDFS"> + <component>DATANODE</component> + </service> + <service name="HBASE"> + <component>REGIONSERVER</component> + </service> + <service name="YARN"> + <component>NODEMANAGER</component> + </service> + + <batch> + <percent>20</percent> + <message>Please run additional tests on {{components}}</message> + </batch> + </group> + + <group name="HIVE" title="Hive"> + <skippable>true</skippable> + <service name="HIVE"> + <component>HIVE_METASTORE</component> + <component>HIVE_SERVER</component> + <component>WEBHCAT_SERVER</component> + </service> + </group> + + <group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}"> + <execute-stage title="Confirm Finalize"> + <task xsi:type="manual"> + <message>Please confirm you are ready to finalize</message> + </task> + </execute-stage> + <execute-stage title="Update remaining HDP stack to {{version}}"> + <task xsi:type="execute"> + <script>scripts/stack_select_set_all.py</script> + <function>actionexecute</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"> + <pre-upgrade> + <task xsi:type="manual"> + <summary>SUMMARY OF PREPARE</summary> + <message>This is a manual task with a placeholder of {{foo/bar}}</message> + </task> + </pre-upgrade> + <pre-downgrade copy-upgrade="true" /> + <upgrade> + <task xsi:type="restart-task" /> + </upgrade> + <post-upgrade> + <task xsi:type="configure" id="foo" /> + </post-upgrade> + <post-downgrade copy-upgrade="true" /> + </component> + </service> + + <service name="HDFS"> + <component name="NAMENODE"> + <pre-upgrade> + <task xsi:type="execute" hosts="master"> + <script>foo</script> + <function>list</function> + </task> + <task xsi:type="configure" id="foo" /> + <task xsi:type="manual"> + <message>{{direction.verb.proper}} your database</message> + </task> + </pre-upgrade> + <pre-downgrade copy-upgrade="true" /> + <upgrade> + <task xsi:type="restart-task" /> + </upgrade> + <post-upgrade> + <task xsi:type="execute"> + <script>foo</script> + <function>list</function> + </task> + </post-upgrade> + <post-downgrade copy-upgrade="true" /> + </component> + <component name="DATANODE"> + <pre-downgrade /> + <upgrade> + <task xsi:type="restart-task" /> + </upgrade> + <post-downgrade> + <task xsi:type="manual"> + <message>Manual Downgrade</message> + </task> + </post-downgrade> + </component> + </service> + + <service name="YARN"> + <component name="RESOURCEMANAGER"> + <pre-upgrade> + <task xsi:type="execute"> + <script>foo</script> + <function>list</function> + </task> + </pre-upgrade> + <pre-downgrade copy-upgrade="true" /> + <upgrade /> + </component> + <component name="NODEMANAGER"> + <pre-upgrade> + <task xsi:type="execute"> + <script>foo</script> + <function>list</function> + </task> + </pre-upgrade> + <pre-downgrade copy-upgrade="true" /> + <upgrade /> + </component> + </service> + + <service name="HIVE"> + <component name="HIVE_SERVER"> + <pre-upgrade> + <task xsi:type="manual"> + <summary>HiveServer Port Availability</summary> + <message>The HiveServer port will now change to 10010 if hive is using a binary transfer mode or 10011 if hive is using an http transport mode. You can use "netstat -anp | grep 1001[01]" to determine if the port is available on each of following HiveServer host(s): {{hosts.all}}. If the port is not available, the process using it must be terminated.</message> + </task> + </pre-upgrade> + <pre-downgrade copy-upgrade="true" /> + <upgrade /> + </component> + </service> + </processing> +</upgrade>