ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [2/2] ambari git commit: AMBARI-13972 RU: Restarting Hive Metastore failed during upgrade (dlysnichenko)
Date Thu, 19 Nov 2015 18:23:52 GMT
AMBARI-13972 RU: Restarting Hive Metastore failed during upgrade (dlysnichenko)


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

Branch: refs/heads/branch-2.1
Commit: 71fa55fa548f67f627c31fb0d55ca17466321ded
Parents: 93878ca
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Nov 19 20:22:15 2015 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Nov 19 20:23:24 2015 +0200

----------------------------------------------------------------------
 .../package/scripts/hive_metastore.py           |  5 +++
 .../stacks/2.1/HIVE/test_hive_metastore.py      | 33 ++++++++++++++++++++
 2 files changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/71fa55fa/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 080225a..084494d 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
@@ -98,6 +98,11 @@ class HiveMetastoreDefault(HiveMetastore):
   def pre_upgrade_restart(self, env, upgrade_type=None):
     Logger.info("Executing Metastore Stack Upgrade pre-restart")
     import params
+
+    if Script.is_hdp_stack_greater_or_equal("2.3"):
+      # disable schema creation on upgrade
+      params.init_metastore_schema = False
+
     env.set_params(params)
 
     if Script.is_hdp_stack_greater_or_equal("2.3"):

http://git-wip-us.apache.org/repos/asf/ambari/blob/71fa55fa/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 7decf19..b3760ad 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
@@ -19,8 +19,10 @@ limitations under the License.
 '''
 import json
 import os
+
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
+from resource_management.libraries.script.script import Script
 
 @patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
 @patch("resource_management.libraries.functions.get_user_call_output.get_user_call_output",
new=MagicMock(return_value=(0,'123','')))
@@ -532,6 +534,37 @@ class TestHiveMetastore(RMFTestCase):
        mocks_dict['call'].call_args_list[0][0][0])
 
 
+  @patch("resource_management.core.shell.call")
+  @patch.object(Script, "is_hdp_stack_greater_or_equal")
+  def test_pre_upgrade_restart_ims(self, is_hdp_stack_greater_or_equal_mock, call_mock):
+    """
+    Tests the state of the init_metastore_schema property on update
+    """
+    is_hdp_stack_greater_or_equal_mock.side_effect = [False, False, False, False, False,
False, True, False, False, False, False, False, False, False]
+
+    config_file = self.get_src_folder() + "/test/python/stacks/2.0.6/configs/default.json"
+    with open(config_file, "r") as f:
+      json_content = json.load(f)
+
+    stack_version = '2.3.0.0-0'
+    version = '2.3.0.0-1234'
+
+    json_content['commandParams']['version'] = version
+    json_content['hostLevelParams']['stack_version'] = stack_version
+
+    mocks_dict = {}
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hive_metastore.py",
+                       classname = "HiveMetastore",
+                       command = "pre_upgrade_restart",
+                       config_dict = json_content,
+                       hdp_stack_version = self.STACK_VERSION,
+                       target = RMFTestCase.TARGET_COMMON_SERVICES,
+                       call_mocks = [(0, None), (0, None)],
+                       mocks_dict = mocks_dict)
+
+    self.assertEquals(False, RMFTestCase.env.config["params"]["init_metastore_schema"])
+
+
   @patch("os.path.exists")
   @patch("resource_management.core.shell.call")
   @patch("resource_management.libraries.functions.get_hdp_version")


Mime
View raw message