ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fba...@apache.org
Subject ambari git commit: AMBARI-10368 [WinTP2] Hive is broken
Date Mon, 06 Apr 2015 16:50:23 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 4d37ee7d1 -> 0de10b795


AMBARI-10368 [WinTP2] Hive is broken

Fixed Hive parameters. Fixed process exit code propagation from cmd script.


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

Branch: refs/heads/trunk
Commit: 0de10b795b66820bb55f1217a4df9e44a9de28c5
Parents: 4d37ee7
Author: Florian Barca <fbarca@hortonworks.com>
Authored: Mon Apr 6 09:50:13 2015 -0700
Committer: Florian Barca <fbarca@hortonworks.com>
Committed: Mon Apr 6 09:50:13 2015 -0700

----------------------------------------------------------------------
 .../services/HIVE/configuration/hive-site.xml   |  5 ++++
 .../2.1/services/HIVE/package/scripts/hive.py   | 29 +++++++++++++++++++-
 .../2.1/services/HIVE/package/scripts/params.py | 16 +++++++++++
 3 files changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0de10b79/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/configuration/hive-site.xml
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/configuration/hive-site.xml
index e479f79..5b657ae 100644
--- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/configuration/hive-site.xml
@@ -17,6 +17,11 @@
   </property>
 
   <property>
+    <name>datanucleus.autoCreateSchema</name>
+    <value>false</value>
+  </property>
+
+  <property>
     <name>hive.querylog.location</name>
     <value>c:\hadoop\logs\hive</value>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/0de10b79/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/hive.py
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/hive.py
index 54b7911..5f21170 100644
--- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/hive.py
+++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/hive.py
@@ -31,4 +31,31 @@ def hive(name=None):
             configuration_attributes=params.config['configuration_attributes']['hive-site']
   )
   if name in ["hiveserver2","metastore"]:
-    Execute(format("cmd /c hadoop fs -mkdir -p {hive_warehouse_dir}"), logoutput=True, user=params.hadoop_user)
\ No newline at end of file
+    Execute(format("cmd /c hadoop fs -mkdir -p {hive_warehouse_dir}"), logoutput=True, user=params.hadoop_user)
+
+  if name == 'metastore':
+    if params.init_metastore_schema:
+      check_schema_created_cmd = format('cmd /c "{hive_bin}\\hive.cmd --service schematool
-info '
+                                        '-dbType {hive_metastore_db_type} '
+                                        '-userName {hive_metastore_user_name} '
+                                        '-passWord {hive_metastore_user_passwd!p}'
+                                        '&set EXITCODE=%ERRORLEVEL%&exit /B %EXITCODE%"',
#cmd "feature", propagate the process exit code manually
+                                        hive_bin=params.hive_bin,
+                                        hive_metastore_db_type=params.hive_metastore_db_type,
+                                        hive_metastore_user_name=params.hive_metastore_user_name,
+                                        hive_metastore_user_passwd=params.hive_metastore_user_passwd)
+      try:
+        Execute(check_schema_created_cmd)
+      except Fail:
+        create_schema_cmd = format('cmd /c {hive_bin}\\hive.cmd --service schematool -initSchema
'
+                                   '-dbType {hive_metastore_db_type} '
+                                   '-userName {hive_metastore_user_name} '
+                                   '-passWord {hive_metastore_user_passwd!p}',
+                                   hive_bin=params.hive_bin,
+                                   hive_metastore_db_type=params.hive_metastore_db_type,
+                                   hive_metastore_user_name=params.hive_metastore_user_name,
+                                   hive_metastore_user_passwd=params.hive_metastore_user_passwd)
+        Execute(create_schema_cmd,
+                user = params.hive_user,
+                logoutput=True
+      )

http://git-wip-us.apache.org/repos/asf/ambari/blob/0de10b79/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/params.py
b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/params.py
index 041669f..aa41e12 100644
--- a/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.1/services/HIVE/package/scripts/params.py
@@ -23,6 +23,10 @@ from resource_management import *
 # server configurations
 config = Script.get_config()
 
+# This is expected to be of the form #.#.#.#
+stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
+hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
+
 hdp_root = os.path.abspath(os.path.join(os.environ["HADOOP_HOME"],".."))
 hive_conf_dir = os.environ["HIVE_CONF_DIR"]
 hive_home = os.environ["HIVE_HOME"]
@@ -37,3 +41,15 @@ hive_warehouse_dir = config['configurations']['hive-site']['hive.metastore.wareh
 hive_user = "hadoop"
 hadoop_user = "hadoop"
 hcat_user = "hadoop"
+
+hive_bin = os.path.join(hive_home, "bin")
+hive_metastore_db_type = config['configurations']['hive-env']['hive_database_type']
+hive_metastore_user_name = config['configurations']['hive-site']['javax.jdo.option.ConnectionUserName']
+hive_metastore_user_passwd = config['configurations']['hive-site']['javax.jdo.option.ConnectionPassword']
+
+######## Metastore Schema
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, "2.1.0.0") < 0:
+  init_metastore_schema = False
+else:
+  init_metastore_schema = True
+


Mime
View raw message