You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/10/26 16:46:05 UTC
[1/2] ambari git commit: AMBARI-13561. RU: Hive Metastore restart
failed (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/branch-2.1 0bac192ee -> 7739bf10a
refs/heads/branch-2.1.2 a7698acb2 -> 4d893c17c
AMBARI-13561. RU: Hive Metastore restart failed (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7739bf10
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7739bf10
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7739bf10
Branch: refs/heads/branch-2.1
Commit: 7739bf10ad1be0a7ec400c31e4763a8fcbbf0013
Parents: 0bac192
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Oct 26 17:45:55 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Oct 26 17:45:55 2015 +0200
----------------------------------------------------------------------
.../package/scripts/hive_metastore.py | 11 ++---
.../0.12.0.2.0/package/scripts/params_linux.py | 9 ++++
.../stacks/2.1/HIVE/test_hive_metastore.py | 44 +++++++++++++++-----
3 files changed, 45 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7739bf10/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 8a3833b..8bdccdc 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
@@ -173,16 +173,11 @@ class HiveMetastoreDefault(HiveMetastore):
if params.hive_jdbc_driver in params.hive_jdbc_drivers_list and params.hive_use_existing_db:
target_directory = format("/usr/hdp/{version}/hive/lib")
- # normally, the JDBC driver would be referenced by /usr/hdp/current/.../foo.jar
- # but if hdp-select is called and the restart fails, then this means that current pointer
- # is now pointing to the upgraded version location; that's bad for the cp command
- source_jdbc_file = format(params.target.replace("/usr/hdp/current", "/usr/hdp/{current_version}"))
-
# download it if it does not exist
- if not os.path.exists(source_jdbc_file):
+ if not os.path.exists(params.source_jdbc_file):
jdbc_connector()
- target_directory_and_filename = os.path.join(target_directory, os.path.basename(source_jdbc_file))
+ target_directory_and_filename = os.path.join(target_directory, os.path.basename(params.source_jdbc_file))
if params.sqla_db_used:
target_native_libs_directory = format("{target_directory}/native/lib64")
@@ -198,7 +193,7 @@ class HiveMetastoreDefault(HiveMetastore):
# copy the JDBC driver from the older metastore location to the new location only
# if it does not already exist
if not os.path.exists(target_directory_and_filename):
- Execute(('cp', source_jdbc_file, target_directory),
+ Execute(('cp', params.source_jdbc_file, target_directory),
path=["/bin", "/usr/bin/"], sudo = True)
File(target_directory_and_filename, mode = 0644)
http://git-wip-us.apache.org/repos/asf/ambari/blob/7739bf10/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 9753166..2955dca 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
@@ -281,6 +281,15 @@ yarn_log_dir_prefix = config['configurations']['yarn-env']['yarn_log_dir_prefix'
target = format("{hive_lib}/{jdbc_jar_name}")
jars_in_hive_lib = format("{hive_lib}/*.jar")
+
+if Script.is_hdp_stack_less_than("2.2"):
+ source_jdbc_file = target
+else:
+ # normally, the JDBC driver would be referenced by /usr/hdp/current/.../foo.jar
+ # but in RU if hdp-select is called and the restart fails, then this means that current pointer
+ # is now pointing to the upgraded version location; that's bad for the cp command
+ source_jdbc_file = format("/usr/hdp/{current_version}/hive/lib/{jdbc_jar_name}")
+
jdk_location = config['hostLevelParams']['jdk_location']
driver_curl_source = format("{jdk_location}/{jdbc_symlink_name}")
http://git-wip-us.apache.org/repos/asf/ambari/blob/7739bf10/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
index 8150cdb..5193109 100644
--- a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
+++ b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
@@ -571,20 +571,42 @@ class TestHiveMetastore(RMFTestCase):
call_mocks = [(0, None), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Execute',
- ('cp', '/usr/hdp/2.2.7.0-1234/hive-server2/lib/mysql-connector-java.jar', '/usr/hdp/2.3.0.0-1234/hive/lib'),
- path = ['/bin', '/usr/bin/'], sudo = True)
+ self.assertResourceCalled('Execute', ('rm', '-f', '/usr/hdp/current/hive-server2/lib/ojdbc6.jar'),
+ path = ['/bin', '/usr/bin/'],
+ sudo = True,
+ )
+ self.assertResourceCalled('File', '/tmp/mysql-connector-java.jar',
+ content = DownloadSource('http://c6401.ambari.apache.org:8080/resources//mysql-jdbc-driver.jar'),
+ )
+ self.assertResourceCalled('Execute', ('cp',
+ '--remove-destination',
+ '/tmp/mysql-connector-java.jar',
+ '/usr/hdp/current/hive-server2/lib/mysql-connector-java.jar'),
+ path = ['/bin', '/usr/bin/'],
+ sudo = True,
+ )
+ self.assertResourceCalled('File', '/usr/hdp/current/hive-server2/lib/mysql-connector-java.jar',
+ mode = 0644,
+ )
+ self.assertResourceCalled('Execute', ('cp',
+ '/usr/hdp/2.2.7.0-1234/hive/lib/mysql-connector-java.jar',
+ '/usr/hdp/2.3.0.0-1234/hive/lib'),
+ path = ['/bin', '/usr/bin/'],
+ sudo = True,
+ )
self.assertResourceCalled('File', '/usr/hdp/2.3.0.0-1234/hive/lib/mysql-connector-java.jar',
- mode = 0644,
+ mode = 0644,
+ )
+ self.assertResourceCalled('Execute', '/usr/hdp/2.3.0.0-1234/hive/bin/schematool -dbType mysql -upgradeSchema',
+ logoutput = True,
+ environment = {'HIVE_CONF_DIR': '/etc/hive/conf.server'},
+ tries = 1,
+ user = 'hive',
+ )
+ self.assertResourceCalled('Execute', ('hdp-select', 'set', 'hive-metastore', '2.3.0.0-1234'),
+ sudo = True,
)
-
- self.assertResourceCalled('Execute', "/usr/hdp/2.3.0.0-1234/hive/bin/schematool -dbType mysql -upgradeSchema",
- logoutput = True, environment = {'HIVE_CONF_DIR': '/etc/hive/conf.server'},
- tries = 1, user = 'hive')
-
- self.assertResourceCalled('Execute', ('hdp-select', 'set', 'hive-metastore', version), sudo=True,)
-
self.assertNoMoreResources()
@patch("os.path.exists")
[2/2] ambari git commit: AMBARI-13561. RU: Hive Metastore restart
failed (aonishuk)
Posted by ao...@apache.org.
AMBARI-13561. RU: Hive Metastore restart failed (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4d893c17
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4d893c17
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4d893c17
Branch: refs/heads/branch-2.1.2
Commit: 4d893c17c03c615a13e3b0e4bce05cc88a03cb22
Parents: a7698ac
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Oct 26 17:45:58 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Oct 26 17:45:58 2015 +0200
----------------------------------------------------------------------
.../package/scripts/hive_metastore.py | 11 ++---
.../0.12.0.2.0/package/scripts/params_linux.py | 9 ++++
.../stacks/2.1/HIVE/test_hive_metastore.py | 44 +++++++++++++++-----
3 files changed, 45 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d893c17/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 8a3833b..8bdccdc 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
@@ -173,16 +173,11 @@ class HiveMetastoreDefault(HiveMetastore):
if params.hive_jdbc_driver in params.hive_jdbc_drivers_list and params.hive_use_existing_db:
target_directory = format("/usr/hdp/{version}/hive/lib")
- # normally, the JDBC driver would be referenced by /usr/hdp/current/.../foo.jar
- # but if hdp-select is called and the restart fails, then this means that current pointer
- # is now pointing to the upgraded version location; that's bad for the cp command
- source_jdbc_file = format(params.target.replace("/usr/hdp/current", "/usr/hdp/{current_version}"))
-
# download it if it does not exist
- if not os.path.exists(source_jdbc_file):
+ if not os.path.exists(params.source_jdbc_file):
jdbc_connector()
- target_directory_and_filename = os.path.join(target_directory, os.path.basename(source_jdbc_file))
+ target_directory_and_filename = os.path.join(target_directory, os.path.basename(params.source_jdbc_file))
if params.sqla_db_used:
target_native_libs_directory = format("{target_directory}/native/lib64")
@@ -198,7 +193,7 @@ class HiveMetastoreDefault(HiveMetastore):
# copy the JDBC driver from the older metastore location to the new location only
# if it does not already exist
if not os.path.exists(target_directory_and_filename):
- Execute(('cp', source_jdbc_file, target_directory),
+ Execute(('cp', params.source_jdbc_file, target_directory),
path=["/bin", "/usr/bin/"], sudo = True)
File(target_directory_and_filename, mode = 0644)
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d893c17/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 253a6f8..f45c423 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
@@ -286,6 +286,15 @@ yarn_log_dir_prefix = config['configurations']['yarn-env']['yarn_log_dir_prefix'
target = format("{hive_lib}/{jdbc_jar_name}")
jars_in_hive_lib = format("{hive_lib}/*.jar")
+
+if Script.is_hdp_stack_less_than("2.2"):
+ source_jdbc_file = target
+else:
+ # normally, the JDBC driver would be referenced by /usr/hdp/current/.../foo.jar
+ # but in RU if hdp-select is called and the restart fails, then this means that current pointer
+ # is now pointing to the upgraded version location; that's bad for the cp command
+ source_jdbc_file = format("/usr/hdp/{current_version}/hive/lib/{jdbc_jar_name}")
+
jdk_location = config['hostLevelParams']['jdk_location']
driver_curl_source = format("{jdk_location}/{jdbc_symlink_name}")
http://git-wip-us.apache.org/repos/asf/ambari/blob/4d893c17/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
index 8150cdb..5193109 100644
--- a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
+++ b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
@@ -571,20 +571,42 @@ class TestHiveMetastore(RMFTestCase):
call_mocks = [(0, None), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Execute',
- ('cp', '/usr/hdp/2.2.7.0-1234/hive-server2/lib/mysql-connector-java.jar', '/usr/hdp/2.3.0.0-1234/hive/lib'),
- path = ['/bin', '/usr/bin/'], sudo = True)
+ self.assertResourceCalled('Execute', ('rm', '-f', '/usr/hdp/current/hive-server2/lib/ojdbc6.jar'),
+ path = ['/bin', '/usr/bin/'],
+ sudo = True,
+ )
+ self.assertResourceCalled('File', '/tmp/mysql-connector-java.jar',
+ content = DownloadSource('http://c6401.ambari.apache.org:8080/resources//mysql-jdbc-driver.jar'),
+ )
+ self.assertResourceCalled('Execute', ('cp',
+ '--remove-destination',
+ '/tmp/mysql-connector-java.jar',
+ '/usr/hdp/current/hive-server2/lib/mysql-connector-java.jar'),
+ path = ['/bin', '/usr/bin/'],
+ sudo = True,
+ )
+ self.assertResourceCalled('File', '/usr/hdp/current/hive-server2/lib/mysql-connector-java.jar',
+ mode = 0644,
+ )
+ self.assertResourceCalled('Execute', ('cp',
+ '/usr/hdp/2.2.7.0-1234/hive/lib/mysql-connector-java.jar',
+ '/usr/hdp/2.3.0.0-1234/hive/lib'),
+ path = ['/bin', '/usr/bin/'],
+ sudo = True,
+ )
self.assertResourceCalled('File', '/usr/hdp/2.3.0.0-1234/hive/lib/mysql-connector-java.jar',
- mode = 0644,
+ mode = 0644,
+ )
+ self.assertResourceCalled('Execute', '/usr/hdp/2.3.0.0-1234/hive/bin/schematool -dbType mysql -upgradeSchema',
+ logoutput = True,
+ environment = {'HIVE_CONF_DIR': '/etc/hive/conf.server'},
+ tries = 1,
+ user = 'hive',
+ )
+ self.assertResourceCalled('Execute', ('hdp-select', 'set', 'hive-metastore', '2.3.0.0-1234'),
+ sudo = True,
)
-
- self.assertResourceCalled('Execute', "/usr/hdp/2.3.0.0-1234/hive/bin/schematool -dbType mysql -upgradeSchema",
- logoutput = True, environment = {'HIVE_CONF_DIR': '/etc/hive/conf.server'},
- tries = 1, user = 'hive')
-
- self.assertResourceCalled('Execute', ('hdp-select', 'set', 'hive-metastore', version), sudo=True,)
-
self.assertNoMoreResources()
@patch("os.path.exists")