ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [2/3] ambari git commit: AMBARI-10566. Ambari Upgrade from 1.7.0 to 2.0.0 fails to restart ZK server due to missing symlink (dlysnichenko)
Date Mon, 20 Apr 2015 17:19:17 GMT
AMBARI-10566. Ambari Upgrade from 1.7.0 to 2.0.0 fails to restart ZK server due to missing
symlink (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 7ad8c9acb5fdf27874d24ade5cbe38f1a59bba34
Parents: 4e06a89
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Mon Apr 20 20:17:25 2015 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Mon Apr 20 20:17:25 2015 +0300

----------------------------------------------------------------------
 .../resource_management/libraries/script/script.py   |  2 +-
 .../AmbariCustomCommandExecutionHelper.java          | 15 +++++++++++++++
 .../3.4.5.2.0/package/scripts/params_linux.py        |  1 +
 .../ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py |  5 ++++-
 .../3.4.5.2.0/package/scripts/zookeeper_server.py    |  7 ++++---
 .../stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py  |  2 ++
 6 files changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7ad8c9ac/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py
b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index 1e35327..34dd16f 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -382,7 +382,7 @@ class Script(object):
     """
     pass
 
-  def configure(self, env):
+  def configure(self, env, rolling_restart=False):
     """
     To be overridden by subclasses
     """

http://git-wip-us.apache.org/repos/asf/ambari/blob/7ad8c9ac/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 2680851..50797a4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -64,6 +64,7 @@ import org.apache.ambari.server.controller.internal.RequestOperationLevel;
 import org.apache.ambari.server.controller.internal.RequestResourceFilter;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.metadata.ActionMetadata;
+import org.apache.ambari.server.orm.dao.ClusterVersionDAO;
 import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
 import org.apache.ambari.server.orm.entities.OperatingSystemEntity;
 import org.apache.ambari.server.orm.entities.RepositoryEntity;
@@ -80,6 +81,7 @@ import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.PropertyInfo.PropertyType;
 import org.apache.ambari.server.state.RepositoryInfo;
+import org.apache.ambari.server.state.RepositoryVersionState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
@@ -146,6 +148,8 @@ public class AmbariCustomCommandExecutionHelper {
   private MaintenanceStateHelper maintenanceStateHelper;
   @Inject
   private OsFamily os_family;
+  @Inject
+  private ClusterVersionDAO clusterVersionDAO;
 
   protected static final String SERVICE_CHECK_COMMAND_NAME = "SERVICE_CHECK";
   protected static final String START_COMMAND_NAME = "START";
@@ -1086,6 +1090,17 @@ public class AmbariCustomCommandExecutionHelper {
     hostLevelParams.put(ORACLE_JDBC_URL, managementController.getOjdbcUrl());
     hostLevelParams.put(DB_DRIVER_FILENAME, configs.getMySQLJarName());
     hostLevelParams.putAll(managementController.getRcaParameters());
+    ClusterVersionEntity clusterVersionEntity = clusterVersionDAO.findByClusterAndStateCurrent(cluster.getClusterName());
+    if (clusterVersionEntity == null) {
+      List<ClusterVersionEntity> clusterVersionEntityList = clusterVersionDAO
+              .findByClusterAndState(cluster.getClusterName(), RepositoryVersionState.UPGRADING);
+      if (!clusterVersionEntityList.isEmpty()) {
+        clusterVersionEntity = clusterVersionEntityList.iterator().next();
+      }
+    }
+    if (clusterVersionEntity != null) {
+      hostLevelParams.put("current_version", clusterVersionEntity.getRepositoryVersion().getVersion());
+    }
 
     return hostLevelParams;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7ad8c9ac/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
index a3136d3..cf555fa 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/params_linux.py
@@ -32,6 +32,7 @@ stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
 hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
 
 stack_name = default("/hostLevelParams/stack_name", None)
+current_version = default("/hostLevelParams/current_version", None)
 
 # New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade
 version = default("/commandParams/version", None)

http://git-wip-us.apache.org/repos/asf/ambari/blob/7ad8c9ac/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
index 4bd94bc..8176e2e 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper.py
@@ -26,7 +26,7 @@ from ambari_commons import OSConst
 from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 
 @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
-def zookeeper(type = None):
+def zookeeper(type = None, rolling_restart = False):
   import params
 
   Directory(params.config_dir,
@@ -71,6 +71,9 @@ def zookeeper(type = None):
          mode = 0644,
          content = myid
     )
+    # This path may be missing after Ambari upgrade. We need to create it.
+    if (not rolling_restart) and (not os.path.exists("/usr/hdp/current/zookeeper-server"))
and params.current_version:
+      Execute(format("hdp-select set zookeeper-server {current_version}"))
 
   if (params.log4j_props != None):
     File(os.path.join(params.config_dir, "log4j.properties"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/7ad8c9ac/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
index b2946f4..fb8a641 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
@@ -41,20 +41,21 @@ from ambari_commons.os_family_impl import OsFamilyImpl
 
 class ZookeeperServer(Script):
 
-  def configure(self, env):
+  def configure(self, env, rolling_restart=False):
     import params
     env.set_params(params)
-    zookeeper(type='server')
+    zookeeper(type='server', rolling_restart=rolling_restart)
 
   def start(self, env, rolling_restart=False):
     import params
     env.set_params(params)
-    self.configure(env)
+    self.configure(env, rolling_restart=rolling_restart)
     zookeeper_service(action = 'start')
 
   def stop(self, env, rolling_restart=False):
     import params
     env.set_params(params)
+    self.configure(env, rolling_restart=rolling_restart)
     zookeeper_service(action = 'stop')
 
 @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)

http://git-wip-us.apache.org/repos/asf/ambari/blob/7ad8c9ac/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
index 61b3f40..e4e09a3 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
@@ -62,6 +62,7 @@ class TestZookeeperServer(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
+    self.assert_configure_default()
     self.assertResourceCalled('Execute', 'source /etc/zookeeper/conf/zookeeper-env.sh ; env
ZOOCFGDIR=/etc/zookeeper/conf ZOOCFG=zoo.cfg /usr/lib/zookeeper/bin/zkServer.sh stop',
       user = 'zookeeper',
     )
@@ -106,6 +107,7 @@ class TestZookeeperServer(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
+    self.assert_configure_secured()
     self.assertResourceCalled('Execute', 'source /etc/zookeeper/conf/zookeeper-env.sh ; env
ZOOCFGDIR=/etc/zookeeper/conf ZOOCFG=zoo.cfg /usr/lib/zookeeper/bin/zkServer.sh stop',
                   user = 'zookeeper',
     )


Mime
View raw message