You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2016/05/16 15:50:00 UTC

ambari git commit: AMBARI-16662. use schematool from hive2.(vbrodetskyi)

Repository: ambari
Updated Branches:
  refs/heads/trunk dd475a9a0 -> 487675978


AMBARI-16662. use schematool from hive2.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 48767597873a5465e4fc095b22c11d7e9a597a49
Parents: dd475a9
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Mon May 16 16:33:30 2016 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Mon May 16 16:33:30 2016 +0300

----------------------------------------------------------------------
 .../HIVE/0.12.0.2.0/package/scripts/hive.py     | 11 ++++---
 .../package/scripts/hive_metastore.py           |  2 +-
 .../0.12.0.2.0/package/scripts/params_linux.py  | 15 +++++++++
 .../services/HIVE/configuration/hive-site.xml   | 34 ++++++++++++++++++++
 4 files changed, 57 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/48767597/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index 7b16474..30ffc8f 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -267,8 +267,11 @@ def hive(name=None):
        content=Template("hive.conf.j2")
        )
 
-  if (name == 'metastore' or name == 'hiveserver2') and params.target_hive is not None and not os.path.exists(params.target_hive):
-    jdbc_connector(params.target_hive)
+  if name == 'metastore' or name == 'hiveserver2':
+    if params.target_hive is not None and not os.path.exists(params.target_hive):
+      jdbc_connector(params.target_hive)
+    if params.target_hive2 is not None and not os.path.exists(params.target_hive2):
+      jdbc_connector(params.target_hive2)
 
   File(format("/usr/lib/ambari-agent/{check_db_connection_jar_name}"),
        content = DownloadSource(format("{jdk_location}{check_db_connection_jar_name}")),
@@ -288,13 +291,13 @@ def hive(name=None):
     )
     if params.init_metastore_schema:
       create_schema_cmd = format("export HIVE_CONF_DIR={hive_server_conf_dir} ; "
-                                 "{hive_bin}/schematool -initSchema "
+                                 "{hive_schematool_bin}/schematool -initSchema "
                                  "-dbType {hive_metastore_db_type} "
                                  "-userName {hive_metastore_user_name} "
                                  "-passWord {hive_metastore_user_passwd!p} -verbose")
 
       check_schema_created_cmd = as_user(format("export HIVE_CONF_DIR={hive_server_conf_dir} ; "
-                                        "{hive_bin}/schematool -info "
+                                        "{hive_schematool_bin}/schematool -info "
                                         "-dbType {hive_metastore_db_type} "
                                         "-userName {hive_metastore_user_name} "
                                         "-passWord {hive_metastore_user_passwd!p} -verbose"), params.hive_user)

http://git-wip-us.apache.org/repos/asf/ambari/blob/48767597/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
index 169f7ea..7554010 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
@@ -223,7 +223,7 @@ class HiveMetastoreDefault(HiveMetastore):
       File(target_directory_and_filename, mode = 0644)
 
     # build the schema tool command
-    binary = format("{stack_root}/{version}/hive/bin/schematool")
+    binary = format("{hive_schematool_ver_bin}/schematool")
 
     # the conf.server directory changed locations between stack versions
     # since the configurations have not been written out yet during an upgrade

http://git-wip-us.apache.org/repos/asf/ambari/blob/48767597/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 4f8aa49..9f5d799 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
@@ -86,7 +86,10 @@ hadoop_bin_dir = "/usr/bin"
 hadoop_home = '/usr'
 hive_user_home_dir = "/home/hive"
 hive_bin = '/usr/lib/hive/bin'
+hive_schematool_bin = '/usr/lib/hive/bin'
+hive_schematool_ver_bin = hive_schematool_bin
 hive_lib = '/usr/lib/hive/lib/'
+hive_lib2 = None
 hive_var_lib = '/var/lib/hive'
 
 # Hive Interactive related paths
@@ -149,6 +152,17 @@ if stack_version_formatted_major and check_stack_feature(StackFeature.ROLLING_UP
   hive_lib = format('{stack_root}/current/{component_directory}/lib')
   hive_interactive_lib = format('{stack_root}/current/{component_directory_interactive}/lib')
 
+  if stack_version_unformatted is not None and check_stack_feature(StackFeature.HIVE_SERVER_INTERACTIVE, stack_version_unformatted):
+    schema_hive_component_ver = "hive2"
+    schema_hive_component = status_params.SERVER_ROLE_DIRECTORY_MAP["HIVE_SERVER_INTERACTIVE"]
+    hive_lib2 = format('{stack_root}/current/{schema_hive_component}/lib')
+  else:
+    schema_hive_component_ver = "hive"
+    schema_hive_component = status_params.SERVER_ROLE_DIRECTORY_MAP["HIVE_SERVER"]
+
+  hive_schematool_ver_bin = format('{stack_root}/{version}/{schema_hive_component_ver}/bin')
+  hive_schematool_bin = format('{stack_root}/current/{schema_hive_component}/bin')
+
   # there are no client versions of these, use server versions directly
   hcat_lib = format('{stack_root}/current/hive-webhcat/share/hcatalog')
   webhcat_bin_dir = format('{stack_root}/current/hive-webhcat/sbin')
@@ -230,6 +244,7 @@ if not hive_use_existing_db:
 
 downloaded_custom_connector = format("{tmp_dir}/{jdbc_jar_name}")
 target_hive = format("{hive_lib}/{jdbc_jar_name}")
+target_hive2 = format("{hive_lib2}/{jdbc_jar_name}") if hive_lib2 is not None else None
 driver_curl_source = format("{jdk_location}/{jdbc_jar_name}")
 
 if not (stack_version_formatted_major and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted_major)):

http://git-wip-us.apache.org/repos/asf/ambari/blob/48767597/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-site.xml
new file mode 100644
index 0000000..cc310bd
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/HIVE/configuration/hive-site.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+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.
+-->
+
+<configuration supports_final="true">
+
+    <property>
+        <name>hive.metastore.schema.verification.record.version</name>
+        <value>false</value>
+        <description>Prevents metastore from overwriting the version number</description>
+    </property>
+
+    <property>
+        <name>hive.metastore.schema.verification</name>
+        <value>false</value>
+        <description>Prevents metastore from complaining about version difference</description>
+    </property>
+
+</configuration>