<commit_before><?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">
  <target>2.2.*</target>
  
  <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">
          <command>ls</command>
        </task>
      </execute-stage>
      <execute-stage title="Confirm 2">
        <task xsi:type="manual">
          <message>Foo</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="Check Unhealthy Hosts" id="unhealthy-hosts">
        <task xsi:type="manual">
          <message>The following hosts were unhealthy and should be resolved before finalizing can be completed:
              {{host-detail-list}}</message>
        </task>
      </execute-stage>
      <execute-stage title="Confirm Finalize">
        <task xsi:type="manual">
          <message>Please confirm you are ready to finalize</message>
        </task>
      </execute-stage>
      <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
        <task xsi:type="execute">
          <command>ls</command>
        </task>
      </execute-stage>
      <execute-stage title="Save Cluster State" service="" component="">
        <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>
        <upgrade>
          <task xsi:type="restart" />
        </upgrade>
        <post-upgrade>
          <task xsi:type="configure" />
        </post-upgrade>
      </component>
    </service>
    
    <service name="HDFS">
      <component name="NAMENODE">
        <pre-upgrade>
          <task xsi:type="execute" hosts="master">
            <command>su - {hdfs-user} -c 'dosomething'</command>
          </task>
          <task xsi:type="configure">
            <type>hdfs-site</type>
            <key>myproperty</key>
            <value>mynewvalue</value>
          </task>
          <task xsi:type="manual">
            <message>{{direction.verb.proper}} your database</message>
          </task>
        </pre-upgrade>
        <upgrade>
          <task xsi:type="restart" />
        </upgrade>
        <post-upgrade>
          <task xsi:type="execute">
            <command>ls</command>
          </task>
        </post-upgrade>
      </component>
      <component name="DATANODE">
        <pre-downgrade />
        <upgrade>
          <task xsi:type="restart" />
        </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">
            <command>ls</command>
          </task>
        </pre-upgrade>
      </component>
      <component name="NODEMANAGER">
        <pre-upgrade>
          <task xsi:type="execute">
            <command>ls</command>
          </task>
          <task xsi:type="configure">
            <type>core-site</type>
            <transfer operation="COPY" from-key="copy-key" to-key="copy-key-to" />
            <transfer operation="COPY" from-type="my-site" from-key="my-copy-key" to-key="my-copy-key-to" />
            <transfer operation="MOVE" from-key="move-key" to-key="move-key-to" />
            <transfer operation="DELETE" delete-key="delete-key" preserve-edits="true">
              <keep-key>important-key</keep-key>
            </transfer>
          </task>
        </pre-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>

          <task xsi:type="configure">
            <condition type="hive-site" key="hive.server2.transport.mode" value="binary">
              <type>hive-site</type>
              <key>hive.server2.thrift.port</key>
              <value>10010</value>
            </condition>
            <condition type="hive-site" key="hive.server2.transport.mode" value="http">
              <type>hive-site</type>
              <key>hive.server2.http.port</key>
              <value>10011</value><commit_msg>AMBARI-11177 - ConfigureTask For Upgrades Must Support Type Coercion (part2) (jonathanhurley)<commit_after><?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">
  <target>2.2.*</target>
  
  <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">
          <command>ls</command>
        </task>
      </execute-stage>
      <execute-stage title="Confirm 2">
        <task xsi:type="manual">
          <message>Foo</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="Check Unhealthy Hosts" id="unhealthy-hosts">
        <task xsi:type="manual">
          <message>The following hosts were unhealthy and should be resolved before finalizing can be completed:
              {{host-detail-list}}</message>
        </task>
      </execute-stage>
      <execute-stage title="Confirm Finalize">
        <task xsi:type="manual">
          <message>Please confirm you are ready to finalize</message>
        </task>
      </execute-stage>
      <execute-stage service="HDFS" component="NAMENODE" title="Execute HDFS Finalize">
        <task xsi:type="execute">
          <command>ls</command>
        </task>
      </execute-stage>
      <execute-stage title="Save Cluster State" service="" component="">
        <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>
        <upgrade>
          <task xsi:type="restart" />
        </upgrade>
        <post-upgrade>
          <task xsi:type="configure" />
        </post-upgrade>
      </component>
    </service>
    
    <service name="HDFS">
      <component name="NAMENODE">
        <pre-upgrade>
          <task xsi:type="execute" hosts="master">
            <command>su - {hdfs-user} -c 'dosomething'</command>
          </task>
          <task xsi:type="configure">
            <type>hdfs-site</type>
            <key>myproperty</key>
            <value>mynewvalue</value>
          </task>
          <task xsi:type="manual">
            <message>{{direction.verb.proper}} your database</message>
          </task>
        </pre-upgrade>
        <upgrade>
          <task xsi:type="restart" />
        </upgrade>
        <post-upgrade>
          <task xsi:type="execute">
            <command>ls</command>
          </task>
        </post-upgrade>
      </component>
      <component name="DATANODE">
        <pre-downgrade />
        <upgrade>
          <task xsi:type="restart" />
        </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">
            <command>ls</command>
          </task>
        </pre-upgrade>
      </component>
      <component name="NODEMANAGER">
        <pre-upgrade>
          <task xsi:type="execute">
            <command>ls</command>
          </task>
          <task xsi:type="configure">
            <type>core-site</type>
              <transfer operation="copy" from-key="copy-key" to-key="copy-key-to" />
              <transfer operation="copy" from-type="my-site" from-key="my-copy-key" to-key="my-copy-key-to" />
              <transfer operation="move" from-key="move-key" to-key="move-key-to" />
              <transfer operation="delete" delete-key="delete-key" preserve-edits="true">
              <keep-key>important-key</keep-key>
            </transfer>
          </task>
        </pre-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>

          <task xsi:type="configure">
            <condition type="hive-site" key="hive.server2.transport.mode" value="binary">
              <type>hive-site</type>
              <key>hive.server2.thrift.port</key>
              <value>10010</value>
            </condition>
            <condition type="hive-site" key="hive.server2.transport.mode" value="http">
              <type>hive-site</type>
              <key>hive.server2.http.port</key>
              <value>10011</value>
{'fraction_non_alphanumeric': 0.13989637305699482, 'fraction_numerical': 0.006318716036901302, 'mean_word_length': 2.304865316349969, 'pattern_counts': {'":': 0, '<': 473, '<?xml version=': 2, '>': 473, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3318361', 'n_tokens_mistral': 4831, 'n_tokens_neox': 4637, 'n_words': 1052}