ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: AMBARI-6709 After Namenode is moved via Ambari the hive metastore namenode hostname is not updated with the new namenode hostname (Dmytro Shkvyra via dsen)
Date Thu, 07 Aug 2014 15:20:23 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c4a553539 -> 334583cdd


AMBARI-6709 After Namenode is moved via Ambari the hive metastore namenode hostname is not
updated with the new namenode hostname (Dmytro Shkvyra via dsen)


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

Branch: refs/heads/trunk
Commit: 334583cdd8dcc3e6d454d626a2734c5e85560396
Parents: c4a5535
Author: Dmytro Sen <dsen@hortonworks.com>
Authored: Thu Aug 7 18:19:55 2014 +0300
Committer: Dmytro Sen <dsen@hortonworks.com>
Committed: Thu Aug 7 18:20:12 2014 +0300

----------------------------------------------------------------------
 .../services/HIVE/package/scripts/hive_service.py  | 13 +++++++++++++
 .../2.0.6/services/HIVE/package/scripts/params.py  |  1 +
 .../python/stacks/2.0.6/HIVE/test_hive_server.py   | 17 +++++++++++------
 3 files changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/334583cd/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py
index 8a57b01..cb10940 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py
@@ -22,6 +22,7 @@ from resource_management import *
 import socket
 import sys
 import time
+from resource_management.core.shell import call
 
 def hive_service(
     name,
@@ -41,6 +42,9 @@ def hive_service(
   process_id_exists = format("ls {pid_file} >/dev/null 2>&1 && ps `cat
{pid_file}` >/dev/null 2>&1")
   
   if action == 'start':
+    if name == 'hiveserver2':
+      check_fs_root()
+
     demon_cmd = format("{cmd}")
     
     Execute(demon_cmd,
@@ -95,3 +99,12 @@ def hive_service(
     Execute(demon_cmd,
             not_if = format("! ({process_id_exists})")
     )
+
+def check_fs_root():
+  import params  
+  fs_root_url = format("{fs_root}{hive_apps_whs_dir}")
+  cmd = "/usr/lib/hive/bin/metatool -listFSRoot 2>/dev/null | grep hdfs://"
+  code, out = call(cmd, user=params.hive_user)
+  if code == 0 and fs_root_url.strip() != out.strip():
+    cmd = format("/usr/lib/hive/bin/metatool -updateLocation {fs_root}{hive_apps_whs_dir}
{out}")
+    Execute(cmd, user=params.hive_user)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/334583cd/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py
index 5b6ac59..c492f04 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py
@@ -66,6 +66,7 @@ smoke_test_path = format("{tmp_dir}/hiveserver2Smoke.sh")
 smoke_user_keytab = config['configurations']['hadoop-env']['smokeuser_keytab']
 
 _authentication = config['configurations']['core-site']['hadoop.security.authentication']
+fs_root = config['configurations']['core-site']['fs.defaultFS']
 security_enabled = ( not is_empty(_authentication) and _authentication == 'kerberos')
 
 kinit_path_local = functions.get_kinit_path(["/usr/bin", "/usr/kerberos/bin", "/usr/sbin"])

http://git-wip-us.apache.org/repos/asf/ambari/blob/334583cd/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
index 4e7df9d..8eb6bd2 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
@@ -46,9 +46,10 @@ class TestHiveServer(RMFTestCase):
                               content='log4jproperties\nline2'
     )
     self.assertNoMoreResources()
-  
+
+  @patch("hive_service.check_fs_root")
   @patch("socket.socket")
-  def test_start_default(self, socket_mock):
+  def test_start_default(self, socket_mock, check_fs_root_mock):
     s = socket_mock.return_value
     
     self.executeScript("2.0.6/services/HIVE/package/scripts/hive_server.py",
@@ -129,6 +130,7 @@ class TestHiveServer(RMFTestCase):
     )
 
     self.assertNoMoreResources()
+    self.assertTrue(check_fs_root_mock.called)
     self.assertTrue(socket_mock.called)
     self.assertTrue(s.close.called)
 
@@ -171,10 +173,11 @@ class TestHiveServer(RMFTestCase):
     )
     self.assertNoMoreResources()
 
+  @patch("hive_service.check_fs_root")
   @patch("socket.socket")
-  def test_start_secured(self, socket_mock):
+  def test_start_secured(self, socket_mock, check_fs_root_mock):
     s = socket_mock.return_value
-    
+
     self.executeScript("2.0.6/services/HIVE/package/scripts/hive_server.py",
                        classname = "HiveServer",
                        command = "start",
@@ -206,6 +209,7 @@ class TestHiveServer(RMFTestCase):
     )
 
     self.assertNoMoreResources()
+    self.assertTrue(check_fs_root_mock.called)
     self.assertTrue(socket_mock.called)
     self.assertTrue(s.close.called)
 
@@ -414,10 +418,11 @@ class TestHiveServer(RMFTestCase):
       owner = 'hive',
       group = 'hadoop',
     )
-    
+
+  @patch("hive_service.check_fs_root")
   @patch("time.time")
   @patch("socket.socket")
-  def test_socket_timeout(self, socket_mock, time_mock):        
+  def test_socket_timeout(self, socket_mock, time_mock, check_fs_root_mock):
     s = socket_mock.return_value
     s.connect = MagicMock()    
     s.connect.side_effect = socket.error("")


Mime
View raw message