You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2017/01/26 01:04:44 UTC
[2/2] ambari git commit: AMBARI-19720. When restarting HSI,
Ambari should not run slider stop and slider destroy (LLAP script
already does that) (smohanty)
AMBARI-19720. When restarting HSI, Ambari should not run slider stop and slider destroy (LLAP script already does that) (smohanty)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/be21bf95
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/be21bf95
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/be21bf95
Branch: refs/heads/branch-2.5
Commit: be21bf95ba9874615f86e3bb71af2cac64e7b064
Parents: ff412f9
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Wed Jan 25 17:04:36 2017 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Wed Jan 25 17:04:36 2017 -0800
----------------------------------------------------------------------
.../package/scripts/hive_server_interactive.py | 5 +-
.../0.12.0.2.0/package/scripts/params_linux.py | 7 +
.../stacks/2.5/HIVE/test_hive_server_int.py | 80 ++
.../2.5/configs/hsi_default_for_restart.json | 1256 ++++++++++++++++++
4 files changed, 1347 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/be21bf95/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
index 053c009..acfddc2 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
@@ -137,7 +137,10 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
# Stop Hive Interactive Server first
hive_service_interactive('hiveserver2', action='stop')
- self._llap_stop(env)
+ if not params.is_restart_command:
+ self._llap_stop(env)
+ else:
+ Logger.info("LLAP stop is skipped as its a restart command")
def status(self, env):
import status_params
http://git-wip-us.apache.org/repos/asf/ambari/blob/be21bf95/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 5e55ff0..10bdd45 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
@@ -227,9 +227,16 @@ if hive_metastore_db_type == "mssql":
#users
hive_user = config['configurations']['hive-env']['hive_user']
+# is it a restart command
+is_restart_command = False
+if 'roleCommand' in config and 'CUSTOM_COMMAND' == config['roleCommand']:
+ if 'custom_command' in config['hostLevelParams'] and 'RESTART' == config['hostLevelParams']['custom_command']:
+ is_restart_command = True
+
#JDBC driver jar name
hive_jdbc_driver = config['configurations']['hive-site']['javax.jdo.option.ConnectionDriverName']
jdk_location = config['hostLevelParams']['jdk_location']
+
java_share_dir = '/usr/share/java'
hive_database_name = config['configurations']['hive-env']['hive_database_name']
hive_database = config['configurations']['hive-env']['hive_database']
http://git-wip-us.apache.org/repos/asf/ambari/blob/be21bf95/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
index ab6528b..9de0378 100644
--- a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
+++ b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
@@ -242,6 +242,85 @@ class TestHiveServerInteractive(RMFTestCase):
)
self.assertNoMoreResources()
+ '''
+ restart should not call slider destroy
+ '''
+ @patch("os.path.isfile")
+ @patch("resource_management.libraries.functions.copy_tarball.copy_to_hdfs")
+ @patch("socket.socket")
+ @patch("time.sleep")
+ def test_restart_default_with_llap_multi_line_output(self, sleep_mock, socket_mock, copy_to_hfds_mock, is_file_mock):
+ self.maxDiff = None
+ copy_to_hfds_mock.return_value = False
+ s = socket_mock.return_value
+ is_file_mock.return_value = True
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hive_server_interactive.py",
+ classname="HiveServerInteractive",
+ command="restart",
+ config_file=self.get_src_folder() + "/test/python/stacks/2.5/configs/hsi_default_for_restart.json",
+ stack_version=self.STACK_VERSION,
+ target=RMFTestCase.TARGET_COMMON_SERVICES,
+ checked_call_mocks=[(0, "OK.", ""),
+ #(0, "OK.", ""),
+ (0, "UNWANTED_STRING \n "
+ " Prepared llap-slider-05Apr2016/run.sh for running LLAP \n "
+ "UNWANTED_STRING \n ", ""),
+ (0, """{
+ \"state\" : \"RUNNING_ALL\"
+ }""", ""),
+ (0, """{
+ \"state\" : \"RUNNING_ALL\"
+ }""", ""),
+ (0, "OK.", "")],
+ )
+
+ self.assertResourceCalled('Execute', "ambari-sudo.sh kill 123",
+ not_if="! (ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1)",
+ )
+ self.assertResourceCalled('Execute',
+ "! (ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1)",
+ tries=10,
+ try_sleep=3,
+ )
+
+ self.assertResourceCalled('Execute',
+ "! (ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1)",
+ tries=20,
+ try_sleep=3,
+ )
+ self.assertResourceCalled('File', '/var/run/hive/hive-interactive.pid',
+ action=['delete'],
+ )
+
+ self.assert_configure_default()
+
+ self.assertResourceCalled('Execute',
+ '/home/hive/llap-slider-05Apr2016/run.sh',
+ logoutput= True, user=u'hive'
+ )
+ self.assertResourceCalled('Execute',
+ 'hive --config /usr/hdp/current/hive-server2-hive2/conf/conf.server --service metatool -updateLocation hdfs://c6401.ambari.apache.org:8020 OK.',
+ environment={'PATH': '/usr/hdp/current/hadoop-client/bin'},
+ user='hive'
+ )
+ self.assertResourceCalled('Execute',
+ '/tmp/start_hiveserver2_interactive_script /var/run/hive/hive-server2-interactive.out /var/log/hive/hive-server2-interactive.err /var/run/hive/hive-interactive.pid /usr/hdp/current/hive-server2-hive2/conf/conf.server /var/log/hive',
+ environment={'HADOOP_HOME': '/usr/hdp/current/hadoop-client',
+ 'HIVE_BIN': 'hive2',
+ 'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+ not_if="ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1",
+ user='hive',
+ path=['/bin:/usr/hdp/current/hive-server2-hive2/bin:/usr/hdp/current/hadoop-client/bin'],
+ )
+ self.assertResourceCalled('Execute',
+ '/usr/jdk64/jdk1.7.0_45/bin/java -cp /usr/lib/ambari-agent/DBConnectionVerification.jar:/usr/hdp/current/hive-server2-hive2/lib/mysql-connector-java.jar org.apache.ambari.server.DBConnectionVerification \'jdbc:mysql://c6402.ambari.apache.org/hive?createDatabaseIfNotExist=true\' hive \'!`"\'"\'"\' 1\' com.mysql.jdbc.Driver',
+ path=['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+ tries=5,
+ try_sleep=10
+ )
+ self.assertNoMoreResources()
+
+
"""
Tests HSI start with llap package creation output having multiple lines.
Sample output : "UNWANTED STRING \n Prepared llap-slider-05Apr2016/run.sh for running LLAP \n UNWANTED STRING \n"
@@ -300,6 +379,7 @@ class TestHiveServerInteractive(RMFTestCase):
)
self.assertNoMoreResources()
+
def test_stop_default(self):
self.maxDiff = None
self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hive_server_interactive.py",