You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2015/12/18 22:36:28 UTC

[1/2] ambari git commit: AMBARI-14437 - Unable To Restart HCat Client When Not Colocated With WebHCat Server (jonathanhurley)

Repository: ambari
Updated Branches:
  refs/heads/trunk f0b029e57 -> b61f6eafa


AMBARI-14437 - Unable To Restart HCat Client When Not Colocated With WebHCat Server (jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b61f6eaf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b61f6eaf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b61f6eaf

Branch: refs/heads/trunk
Commit: b61f6eafab1e2eb6ef7ae8dacce87baa742933eb
Parents: 3b693ea
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Dec 18 14:35:46 2015 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Dec 18 16:36:20 2015 -0500

----------------------------------------------------------------------
 .../0.12.0.2.0/package/scripts/hcat_client.py   | 37 +++++++++++++++++---
 .../stacks/2.0.6/HIVE/test_hcat_client.py       | 24 +++++++++++++
 2 files changed, 57 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b61f6eaf/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
index 75a37f1..b372085 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
@@ -18,12 +18,14 @@ limitations under the License.
 
 """
 
-import sys
-from resource_management import *
 from hcat import hcat
-from setup_atlas_hive import setup_atlas_hive
 from ambari_commons import OSConst
 from ambari_commons.os_family_impl import OsFamilyImpl
+from resource_management.core.logger import Logger
+from resource_management.core.exceptions import ClientComponentHasNoStatus
+from resource_management.libraries.functions import hdp_select
+from resource_management.libraries.functions.version import compare_versions
+from resource_management.libraries.script.script import Script
 
 
 class HCatClient(Script):
@@ -49,7 +51,34 @@ class HCatClientWindows(HCatClient):
 @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
 class HCatClientDefault(HCatClient):
   def get_stack_to_component(self):
-    return {"HDP": "hadoop-client"}
+    # HCat client doesn't have a first-class entry in hdp-select. Since clients always
+    # update after daemons, this ensures that the hcat directories are correct on hosts
+    # which do not include the WebHCat daemon
+    return {"HDP": "hive-webhcat"}
+
+
+  def pre_upgrade_restart(self, env, upgrade_type=None):
+    """
+    Execute hdp-select before reconfiguring this client to the new HDP version.
+
+    :param env:
+    :param upgrade_type:
+    :return:
+    """
+    Logger.info("Executing Hive HCat Client Stack Upgrade pre-restart")
+
+    import params
+    env.set_params(params)
+
+    # this function should not execute if the version can't be determined or
+    # is not at least HDP 2.2.0.0
+    if not params.version or compare_versions(params.version, "2.2", format=True) < 0:
+      return
+
+    # HCat client doesn't have a first-class entry in hdp-select. Since clients always
+    # update after daemons, this ensures that the hcat directories are correct on hosts
+    # which do not include the WebHCat daemon
+    hdp_select.select("hive-webhcat", params.version)
 
 
 if __name__ == "__main__":

http://git-wip-us.apache.org/repos/asf/ambari/blob/b61f6eaf/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hcat_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hcat_client.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hcat_client.py
index 396e6a1..4dfa688 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hcat_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hcat_client.py
@@ -17,6 +17,7 @@ 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.
 '''
+import json
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
 
@@ -100,3 +101,26 @@ class TestHcatClient(RMFTestCase):
                               )
 
     self.assertNoMoreResources()
+
+
+  @patch("resource_management.core.shell.call")
+  def test_pre_upgrade_restart(self, call_mock):
+    config_file = self.get_src_folder()+"/test/python/stacks/2.0.6/configs/default.json"
+    with open(config_file, "r") as f:
+      json_content = json.load(f)
+
+    version = '2.3.0.0-1234'
+    json_content['commandParams']['version'] = version
+
+    mocks_dict = {}
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hcat_client.py",
+      classname = "HCatClient",
+      command = "pre_upgrade_restart",
+      config_dict = json_content,
+      hdp_stack_version = self.STACK_VERSION,
+      target = RMFTestCase.TARGET_COMMON_SERVICES,
+      call_mocks = [(0, None, ''), (0, None, ''), (0, None, ''), (0, None, '')],
+      mocks_dict = mocks_dict)
+
+    self.assertResourceCalled('Execute',('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hive-webhcat', version), sudo=True,)
+    self.assertNoMoreResources()
\ No newline at end of file


[2/2] ambari git commit: AMBARI-14436 - Spark ThriftServer Does Not Upgrade (jonathanhurley)

Posted by jo...@apache.org.
AMBARI-14436 - Spark ThriftServer Does Not Upgrade (jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3b693eab
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3b693eab
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3b693eab

Branch: refs/heads/trunk
Commit: 3b693eab67e5f37229cc0070fa52d68f730c7c3e
Parents: f0b029e
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Fri Dec 18 14:30:45 2015 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Dec 18 16:36:20 2015 -0500

----------------------------------------------------------------------
 .../resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml    | 1 +
 .../src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml      | 1 +
 2 files changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3b693eab/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
index 5e0d364..3b45149 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
@@ -437,6 +437,7 @@
       <parallel-scheduler/>
       <service name="SPARK">
         <component>SPARK_JOBHISTORYSERVER</component>
+        <component>SPARK_THRIFTSERVER</component>
       </service>
     </group>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b693eab/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
index e31e7fb..29384b0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
@@ -226,6 +226,7 @@
       <service-check>false</service-check>
       <service name="SPARK">
         <component>SPARK_JOBHISTORYSERVER</component>
+        <component>SPARK_THRIFTSERVER</component>
       </service>
     </group>