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/09/24 16:59:57 UTC

[3/3] ambari git commit: AMBARI-13228. HBase service start fails after manual stack upgrade with missing PhoenixRpcSchedulerFactory class error (aonishuk)

AMBARI-13228. HBase service start fails after manual stack upgrade with missing PhoenixRpcSchedulerFactory class error (aonishuk)


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

Branch: refs/heads/branch-2.1.2
Commit: 9c2bd75ec569d853c463fb35fb216c6d2cd4be93
Parents: 0dab1ce
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Sep 24 17:59:44 2015 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Sep 24 17:59:44 2015 +0300

----------------------------------------------------------------------
 ambari-server/src/main/python/upgradeHelper.py  | 32 ++++++++++++++++++--
 .../catalog/UpgradeCatalog_2.1_to_2.3.json      |  8 ++++-
 .../catalog/UpgradeCatalog_2.2_to_2.3.json      |  8 ++++-
 .../src/test/python/TestUpgradeHelper.py        |  5 ++-
 4 files changed, 46 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9c2bd75e/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 4189b95..c09502f 100644
--- a/ambari-server/src/main/python/upgradeHelper.py
+++ b/ambari-server/src/main/python/upgradeHelper.py
@@ -207,6 +207,7 @@ class Options(Const):
   REPLACE_JH_HOST_NAME_TAG = "REPLACE_JH_HOST"
   REPLACE_RM_HOST_NAME_TAG = "REPLACE_RM_HOST"
   REPLACE_WITH_TAG = "REPLACE_WITH_"
+  PHOENIX_QUERY_SERVER = "PHOENIX_QUERY_SERVER"
   ZK_OPTIONS = "zoo.cfg"
   KAFKA_BROKER_CONF = "kafka-broker"
   RANGER_ADMIN = "admin-properties"
@@ -1396,8 +1397,6 @@ def get_tez_history_url_base():
     raise TemplateProcessingException(str(e))
 
   version = ""
-
-
   if "versions" in tez_view and \
     len(tez_view['versions']) > 0 and \
     "ViewVersionInfo" in tez_view['versions'][0] and \
@@ -1419,6 +1418,24 @@ def get_kafka_listeners():
 
   return kafka_listeners
 
+
+def check_phoenix_component_existence():
+  try:
+    resultset = curl(Options.COMPONENTS_FORMAT.format(Options.PHOENIX_QUERY_SERVER), validate=False, parse=True)
+  except HTTPError as e:
+    raise TemplateProcessingException(str(e))
+
+  if "ServiceComponentInfo" in resultset and "total_count" in resultset["ServiceComponentInfo"]:
+    try:
+      component_count = int(resultset["ServiceComponentInfo"]["total_count"])
+      if component_count > 0:
+        return True
+    except ValueError:
+      return False
+
+  return False
+
+
 def get_ranger_xaaudit_hdfs_destination_directory():
   namenode_hostname="localhost"
   namenode_cfg = curl(Options.COMPONENTS_FORMAT.format(Options.NAMENODE), validate=False, parse=True)
@@ -1606,6 +1623,11 @@ def get_hbase_coprocessmaster_classes():
 
   return old_value
 
+def get_rpc_scheduler_factory_class():
+  if check_phoenix_component_existence():
+    return "org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory"
+  else:
+    return ""
 
 def get_hbase_coprocessor_region_classes():
   scf = Options.server_config_factory
@@ -1644,6 +1666,8 @@ def _substitute_handler(upgrade_catalog, tokens, value):
       value = value.replace(token, get_jh_host(upgrade_catalog))
     elif token == "{RESOURCEMANAGER_HOST}":
       value = value.replace(token, get_jt_host(upgrade_catalog))
+    elif token == "{HBASE_REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS}":
+      value = value.replace(token, get_rpc_scheduler_factory_class())
     elif token == "{ZOOKEEPER_QUORUM}":
       value = value.replace(token, get_zookeeper_quorum())
     elif token == "{HBASE_COPROCESS_MASTER_CLASSES}":
@@ -1933,8 +1957,12 @@ def curl(url, tokens=None, headers=None, request_type="GET", data=None, parse=Fa
     if write_only_print:
       if request_type in post_req:
         Options.logger.info(url)
+        if data is not None:
+          Options.logger.info("POST Data: \n" + str(data))
     else:
       Options.logger.info(url)
+      if request_type in post_req and data is not None:
+        Options.logger.info("POST Data: \n" + str(data))
 
   code = 200
   if not (print_url and request_type in post_req):

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c2bd75e/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 fc2ff87..25c728b 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
@@ -257,7 +257,13 @@
           "hbase.hregion.majorcompaction": "604800000",
           "hbase.hregion.memstore.block.multiplier": "4",
           "hbase.hstore.flush.retries.number": {"remove": "yes"},
-          "hbase.region.server.rpc.scheduler.factory.class": "org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory",
+          "hbase.region.server.rpc.scheduler.factory.class": {
+            "value": "{HBASE_REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS}",
+            "required-services": [
+              "HBASE"
+            ],
+            "template": "yes"
+          },
           "hbase.rpc.controllerfactory.class": "org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory",
           "hbase.regionserver.wal.codec": "org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec",
           "phoenix.functions.allowUserDefinedFunctions": "true",

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c2bd75e/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.2_to_2.3.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.2_to_2.3.json b/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.2_to_2.3.json
index 4fec857..eddc1a7 100644
--- a/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.2_to_2.3.json
+++ b/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.2_to_2.3.json
@@ -386,7 +386,13 @@
           }
         },
         "hbase-site": {
-          "hbase.region.server.rpc.scheduler.factory.class": "org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory",
+          "hbase.region.server.rpc.scheduler.factory.class": {
+            "value": "{HBASE_REGION_SERVER_RPC_SCHEDULER_FACTORY_CLASS}",
+            "required-services": [
+              "HBASE"
+            ],
+            "template": "yes"
+          },
           "hbase.rpc.controllerfactory.class": "org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory",
           "hbase.regionserver.wal.codec": "org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec",
           "phoenix.functions.allowUserDefinedFunctions": "true",

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c2bd75e/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 9de2ed1..6da4507 100644
--- a/ambari-server/src/test/python/TestUpgradeHelper.py
+++ b/ambari-server/src/test/python/TestUpgradeHelper.py
@@ -1,4 +1,4 @@
-'''
+"""
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
@@ -14,7 +14,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-'''
+"""
 
 
 from mock.mock import MagicMock, call
@@ -923,7 +923,6 @@ class TestUpgradeHelper(TestCase):
     self.assertEqual(1, configuration_diff_analyze_mock.call_count)
     self.assertEqual(1, open_mock.call_count)
 
-
   def test_report_formatter(self):
     file = StringIO()
     cfg_item = self.catalog_cfg_type