Browse Source

AMBARI-16938. Deploy: UI: Hive_metastore not started.(vbrodetskyi)

Vitaly Brodetskyi 9 years ago
parent
commit
1e4fc9a7db

+ 5 - 5
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py

@@ -269,9 +269,9 @@ def hive(name=None):
 
   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)
+      jdbc_connector(params.target_hive, params.hive_previous_jdbc_jar)
     if params.target_hive2 is not None and not os.path.exists(params.target_hive2):
-      jdbc_connector(params.target_hive2)
+      jdbc_connector(params.target_hive2, params.hive2_previous_jdbc_jar)
 
   File(format("/usr/lib/ambari-agent/{check_db_connection_jar_name}"),
        content = DownloadSource(format("{jdk_location}{check_db_connection_jar_name}")),
@@ -415,7 +415,7 @@ def fill_conf_dir(component_conf_dir):
     pass # if params.log4j_version == '1'
 
 
-def jdbc_connector(target):
+def jdbc_connector(target, hive_previous_jdbc_jar):
   """
   Shared by Hive Batch, Hive Metastore, and Hive Interactive
   :param target: Target of jdbc jar name, which could be for any of the components above.
@@ -430,8 +430,8 @@ def jdbc_connector(target):
       "no_proxy": format("{ambari_server_hostname}")
     }
 
-    if params.hive_previous_jdbc_jar and os.path.isfile(params.hive_previous_jdbc_jar):
-      File(params.hive_previous_jdbc_jar, action='delete')
+    if hive_previous_jdbc_jar and os.path.isfile(hive_previous_jdbc_jar):
+      File(hive_previous_jdbc_jar, action='delete')
 
     # TODO: should be removed after ranger_hive_plugin will not provide jdbc
     Execute(('rm', '-f', params.prepackaged_ojdbc_symlink),

+ 1 - 1
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py

@@ -197,7 +197,7 @@ def hive_interactive(name=None):
        content=Template("hive.conf.j2"))
 
   if not os.path.exists(params.target_hive_interactive):
-    jdbc_connector(params.target_hive_interactive)
+    jdbc_connector(params.target_hive_interactive, params.hive_intaractive_previous_jdbc_jar)
 
   File(format("/usr/lib/ambari-agent/{check_db_connection_jar_name}"),
        content = DownloadSource(format("{jdk_location}{check_db_connection_jar_name}")),

+ 1 - 1
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py

@@ -199,7 +199,7 @@ class HiveMetastoreDefault(HiveMetastore):
 
       # download it if it does not exist
       if not os.path.exists(params.source_jdbc_file):
-        jdbc_connector(params.target_hive)
+        jdbc_connector(params.target_hive, params.hive_previous_jdbc_jar)
 
       target_directory_and_filename = os.path.join(target_directory, os.path.basename(params.source_jdbc_file))
 

+ 2 - 0
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py

@@ -259,6 +259,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
+hive2_previous_jdbc_jar = format("{hive_lib2}/{hive_previous_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)):
@@ -373,6 +374,7 @@ yarn_log_dir_prefix = config['configurations']['yarn-env']['yarn_log_dir_prefix'
 
 target_hive = format("{hive_lib}/{jdbc_jar_name}")
 target_hive_interactive = format("{hive_interactive_lib}/{jdbc_jar_name}")
+hive_intaractive_previous_jdbc_jar = format("{hive_interactive_lib}/{hive_previous_jdbc_jar_name}")
 jars_in_hive_lib = format("{hive_lib}/*.jar")
 
 start_hiveserver2_path = format("{tmp_dir}/start_hiveserver2_script")