Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 820A3200BC1 for ; Wed, 16 Nov 2016 14:57:29 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 80DA0160B25; Wed, 16 Nov 2016 13:57:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C80F8160B13 for ; Wed, 16 Nov 2016 14:57:28 +0100 (CET) Received: (qmail 35832 invoked by uid 500); 16 Nov 2016 13:57:27 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 35713 invoked by uid 99); 16 Nov 2016 13:57:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Nov 2016 13:57:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 87939E0209; Wed, 16 Nov 2016 13:57:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ncole@apache.org To: commits@ambari.apache.org Date: Wed, 16 Nov 2016 13:57:31 -0000 Message-Id: <3e9c7eb6f8ab4c0caafa149000cb7944@git.apache.org> In-Reply-To: <9fa3c615e982460bb73c0f8d82a8b3da@git.apache.org> References: <9fa3c615e982460bb73c0f8d82a8b3da@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [05/29] ambari git commit: AMBARI-18887 - Hive Service Check Fails During Upgrade Due to Missing Imports (jonathanhurley) archived-at: Wed, 16 Nov 2016 13:57:29 -0000 AMBARI-18887 - Hive Service Check Fails During Upgrade Due to Missing Imports (jonathanhurley) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/45adfdf7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/45adfdf7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/45adfdf7 Branch: refs/heads/branch-dev-patch-upgrade Commit: 45adfdf778b44e28c607264f8026404e02633463 Parents: bc7a29f Author: Jonathan Hurley Authored: Mon Nov 14 15:52:31 2016 -0500 Committer: Jonathan Hurley Committed: Mon Nov 14 16:44:30 2016 -0500 ---------------------------------------------------------------------- .../0.12.0.2.0/package/scripts/params_linux.py | 2 - .../0.12.0.2.0/package/scripts/service_check.py | 10 ++--- .../2.0.6/HIVE/test_hive_service_check.py | 43 +++++++++++++++++++- 3 files changed, 46 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/45adfdf7/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py index 3caaefc..e9372f9 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py @@ -108,8 +108,6 @@ hive_user_home_dir = "/home/hive" hive_server2_hive2_dir = None hive_server2_hive2_lib = None -version = default("/commandParams/version", None) - if check_stack_feature(StackFeature.HIVE_SERVER_INTERACTIVE, version_for_stack_feature_checks): # the name of the hiveserver2-hive2 component hive_server2_hive2_component = status_params.SERVER_ROLE_DIRECTORY_MAP["HIVE_SERVER_INTERACTIVE"] http://git-wip-us.apache.org/repos/asf/ambari/blob/45adfdf7/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py index 90a97fe..d144c34 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py +++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/service_check.py @@ -18,8 +18,7 @@ limitations under the License. """ -import socket -import sys +import os import time import subprocess @@ -27,15 +26,14 @@ from hcat_service_check import hcat_service_check from webhcat_service_check import webhcat_service_check from ambari_commons import OSConst from ambari_commons.os_family_impl import OsFamilyImpl -from resource_management.core import shell from resource_management.core.logger import Logger from resource_management.libraries.functions import get_unique_id_and_date from resource_management.libraries.script.script import Script from resource_management.libraries.functions.format import format from resource_management.libraries.functions.hive_check import check_thrift_port_sasl -from resource_management.core.resources.system import Execute, File +from resource_management.core.resources.system import Execute from resource_management.core.exceptions import Fail -from resource_management.core.source import StaticFile + class HiveServiceCheck(Script): pass @@ -173,7 +171,7 @@ class HiveServiceCheckDefault(HiveServiceCheck): beeline_url.append('principal={key}') exec_path = params.execute_path - if params.version and params.stack_root: + if params.version: upgrade_hive_bin = format("{stack_root}/{version}/hive2/bin") exec_path = os.environ['PATH'] + os.pathsep + params.hadoop_bin_dir + os.pathsep + upgrade_hive_bin http://git-wip-us.apache.org/repos/asf/ambari/blob/45adfdf7/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_service_check.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_service_check.py index 30b4eb7..9c73d30 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_service_check.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_service_check.py @@ -259,7 +259,6 @@ class TestServiceCheck(RMFTestCase): self.assertNoMoreResources() - def test_service_check_during_upgrade(self, socket_mock): config_file = self.get_src_folder() + "/test/python/stacks/2.2/configs/hive-upgrade.json" with open(config_file, 'r') as f: @@ -289,3 +288,45 @@ class TestServiceCheck(RMFTestCase): tries = 3, user = 'ambari-qa', try_sleep = 5) + + + def test_service_check_during_upgrade_for_llap(self, socket_mock): + config_file = self.get_src_folder() + "/test/python/stacks/2.2/configs/hive-upgrade.json" + with open(config_file, 'r') as f: + json_content = json.load(f) + + # populate version and an LLAP instance to trigger the LLAP service check + json_content['commandParams']['version'] = "2.3.0.0-1234" + json_content['clusterHostInfo']['hive_server_interactive_hosts'] = ["c6402.ambari.apache.org"] + json_content['configurations']['hive-interactive-env'] = {} + json_content['configurations']['hive-interactive-env']['enable_hive_interactive'] = True + + + self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/service_check.py", + classname = "HiveServiceCheck", + command = "service_check", + config_dict = json_content, + stack_version = self.STACK_VERSION, + target = RMFTestCase.TARGET_COMMON_SERVICES) + + self.assertResourceCalled('Execute', + "! beeline -u 'jdbc:hive2://c6402.ambari.apache.org:10010/;transportMode=binary' -e '' 2>&1| awk '{print}'|grep -i -e 'Connection refused' -e 'Invalid URL'", + path = ['/bin/', '/usr/bin/', '/usr/lib/hive/bin/', '/usr/sbin/'], + timeout = 30, + user = 'ambari-qa') + + self.assertResourceCalled('Execute', + "! beeline -u 'jdbc:hive2://c6402.ambari.apache.org:10500/;transportMode=binary' -e '' 2>&1| awk '{print}'|grep -i -e 'Connection refused' -e 'Invalid URL'", + path = ['/bin/', '/usr/bin/', '/usr/lib/hive/bin/', '/usr/sbin/'], + timeout = 30, + user = 'ambari-qa') + + # LLAP call + self.assertResourceCalled('Execute', + "! beeline -u 'jdbc:hive2://c6402.ambari.apache.org:10500/;transportMode=binary' --hiveconf \"hiveLlapServiceCheck=\" -f /usr/hdp/current/hive-server2-hive2/scripts/llap/sql/serviceCheckScript.sql -e '' 2>&1| awk '{print}'|grep -i -e 'Invalid status\|Invalid URL\|command not found\|Connection refused'", + path = ['/usr/sbin', '/usr/local/bin', '/bin', '/usr/bin', '/bin:/usr/hdp/current/hadoop-client/bin:/usr/hdp/2.3.0.0-1234/hive2/bin'], + tries = 1, + stderr = -1, + wait_for_finish = True, + logoutput = True, + user = 'hive')