ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-12388. Hbase start failed on upgrade.(vbrodetskyi)
Date Sat, 11 Jul 2015 20:26:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e43e37f07 -> f540afa05


AMBARI-12388. Hbase start failed on upgrade.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: f540afa050303d6500c0f0096881848c96b4e1be
Parents: e43e37f
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Sat Jul 11 23:19:53 2015 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Sat Jul 11 23:19:53 2015 +0300

----------------------------------------------------------------------
 ambari-server/src/main/python/upgradeHelper.py  |  9 ++-
 .../catalog/UpgradeCatalog_2.1_to_2.3.json      |  6 +-
 .../src/test/python/TestUpgradeHelper.py        | 61 ++++++++++++++++++++
 3 files changed, 74 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f540afa0/ambari-server/src/main/python/upgradeHelper.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/upgradeHelper.py b/ambari-server/src/main/python/upgradeHelper.py
index b5f123e..4cffe78 100644
--- a/ambari-server/src/main/python/upgradeHelper.py
+++ b/ambari-server/src/main/python/upgradeHelper.py
@@ -69,6 +69,7 @@ Example:
           },
           "test_property": {
            "value": "new value",
+           "override: "no", (optional, override already existed property yes/no)
            "value-required": "old value"  (optional, property would be set if the required
value is present)
           }
         }
@@ -288,6 +289,7 @@ class CatConst(Const):
   COERCE_YAML_OPTION_TAG = "yaml-array"
   REPLACE_FROM_TAG = "replace-from"
   REPLACE_TO_TAG = "replace-to"
+  OVERRIDE_TAG = "override"
   ITEMS_TAG = "items"
   TYPE_TAG = "type"
   TRUE_TAG = "yes"
@@ -520,7 +522,12 @@ class UpgradeCatalog(object):
     :type properties dict
     """
     catalog_property_item = dict(catalog_property_item)
-    if CatConst.PROPERTY_VALUE_TAG in catalog_property_item and catalog_item_name in properties:
+    can_override = True
+
+    if CatConst.OVERRIDE_TAG in catalog_property_item and catalog_property_item[CatConst.OVERRIDE_TAG]
!= CatConst.TRUE_TAG:
+      can_override = False
+
+    if CatConst.PROPERTY_VALUE_TAG in catalog_property_item and catalog_item_name in properties
and can_override:
       self.__handle_template_tag_sub(catalog_item_name, catalog_property_item)
       properties[catalog_item_name] = catalog_property_item[CatConst.PROPERTY_VALUE_TAG]
     return properties

http://git-wip-us.apache.org/repos/asf/ambari/blob/f540afa0/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.1_to_2.3.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.1_to_2.3.json
b/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.1_to_2.3.json
index 5a233b7..5b7d454 100644
--- a/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.1_to_2.3.json
+++ b/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.1_to_2.3.json
@@ -246,7 +246,11 @@
           "hbase.regionserver.wal.codec": "org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec",
           "phoenix.functions.allowUserDefinedFunctions": "true",
           "fs.hdfs.impl": "org.apache.hadoop.hdfs.DistributedFileSystem",
-          "hbase.bucketcache.percentage.in.combinedcache": {"remove": "yes"}
+          "hbase.bucketcache.percentage.in.combinedcache": {"remove": "yes"},
+          "hbase.bulkload.staging.dir": {
+            "value": "/apps/hbase/staging",
+            "override": "no"
+          }
         },
         "mapred-site": {
           "mapreduce.job.emit-timeline-data": "false",

http://git-wip-us.apache.org/repos/asf/ambari/blob/f540afa0/ambari-server/src/test/python/TestUpgradeHelper.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestUpgradeHelper.py b/ambari-server/src/test/python/TestUpgradeHelper.py
index 4956d9a..879c8d2 100644
--- a/ambari-server/src/test/python/TestUpgradeHelper.py
+++ b/ambari-server/src/test/python/TestUpgradeHelper.py
@@ -476,6 +476,67 @@ class TestUpgradeHelper(TestCase):
     self.assertEqual("['host1.com']", cfg.properties["test-arr"])
 
   @patch.object(upgradeHelper, "get_config_resp_all")
+  def test_override_tag(self, get_config_resp_all_mock):
+    test_catalog = """
+        {
+      "version": "1.0",
+      "stacks": [
+        {
+          "name": "HDP",
+          "old-version": "1.0",
+          "target-version": "1.1",
+          "options": {
+            "config-types":{
+              "test": {
+                "merged-copy": "yes"
+              }
+            }
+          },
+          "properties": {
+             "test": {
+               "test_property": {
+                  "value": "host1.com",
+                  "override": "no"
+                }
+
+            }
+          },
+          "property-mapping": {}
+        }
+      ]
+    }
+    """
+    old_opt = upgradeHelper.Options.OPTIONS
+    options = lambda: ""
+    options.from_stack = "1.0"
+    options.to_stack = "1.1"
+    options.upgrade_json = ""
+
+    upgradeHelper.Options.OPTIONS = options
+    upgradeHelper.Options.SERVICES = [self.required_service]
+    get_config_resp_all_mock.return_value = {
+      "test": {
+        "properties": {
+          "test_property": "test host"
+        }
+      }
+    }
+
+    ucf = UpgradeCatalogFactoryMock(test_catalog)
+    scf = upgradeHelper.ServerConfigFactory()
+
+    cfg = scf.get_config("test")
+    ucfg = ucf.get_catalog("1.0", "1.1")
+
+    cfg.merge(ucfg)
+    scf.process_mapping_transformations(ucfg)
+
+    upgradeHelper.Options.OPTIONS = old_opt
+
+    self.assertEqual(True, "test_property" in cfg.properties)
+    self.assertEqual("test host", cfg.properties["test_property"])
+
+  @patch.object(upgradeHelper, "get_config_resp_all")
   def test_replace_tag(self, get_config_resp_all_mock):
     test_catalog = """
         {


Mime
View raw message