Browse Source

AMBARI-9548. Updating FSRoot for Hive Metastore doesn't seem to work (breaks Hive functionality after move NameNode and NameNode HA) (aonishuk)

Andrew Onishuk 10 years ago
parent
commit
43150b95aa

+ 4 - 3
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service.py

@@ -127,10 +127,11 @@ def hive_service(name, action='start', rolling_restart=False):
 def check_fs_root():
   import params  
   fs_root_url = format("{fs_root}{hive_apps_whs_dir}")
-  cmd = format("metatool -listFSRoot 2>/dev/null | grep hdfs:// | grep -v '.db$'")
-  code, out = shell.call(cmd, user=params.hive_user)
+  metatool_cmd = format("hive --config {hive_server_conf_dir} --service metatool")
+  cmd = format("{metatool_cmd} -listFSRoot 2>/dev/null | grep hdfs:// | grep -v '.db$'")
+  code, out = shell.call(cmd, user=params.hive_user, env={'PATH' : params.execute_path })
   if code == 0 and fs_root_url.strip() != out.strip():
-    cmd = format("metatool -updateLocation {fs_root}{hive_apps_whs_dir} {out}")
+    cmd = format("{metatool_cmd} -updateLocation {fs_root}{hive_apps_whs_dir} {out}")
     Execute(cmd,
             environment= {'PATH' : params.execute_path },
             user=params.hive_user)

+ 2 - 1
ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py

@@ -57,7 +57,8 @@ class TestHiveServer(RMFTestCase):
     )
 
     self.assert_configure_default()
-    self.assertResourceCalled('Execute', 'metatool -updateLocation hdfs://c6401.ambari.apache.org:8020/apps/hive/warehouse ',
+    self.printResources()
+    self.assertResourceCalled('Execute', 'hive --config /etc/hive/conf.server --service metatool -updateLocation hdfs://c6401.ambari.apache.org:8020/apps/hive/warehouse ',
         environment = {'PATH' : "/bin:/usr/lib/hive/bin:/usr/bin"},
         user = 'hive',
     )