ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-9579. After upgrading Ambari 1.6.1 to 1.7, the directory of zookeeper server get changed to /hadoop/zookeeper (dlysnichenko)
Date Wed, 11 Feb 2015 19:05:35 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a49bc274e -> fad54e324


AMBARI-9579. After upgrading Ambari 1.6.1 to 1.7, the directory of zookeeper server get changed
to /hadoop/zookeeper (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: fad54e324da628568b3a6aad3243ce36a62a3894
Parents: a49bc27
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Wed Feb 11 21:05:04 2015 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Wed Feb 11 21:05:04 2015 +0200

----------------------------------------------------------------------
 .../ambari/server/upgrade/UpgradeCatalog170.java      | 14 +++++++++++---
 .../ambari/server/upgrade/UpgradeCatalog170Test.java  |  7 +++++--
 2 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fad54e32/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
index a7736dd..47f4587 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
@@ -1178,6 +1178,7 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
         for (Map.Entry<String, String> property : globalProperites.entrySet()) {
           String propertyName = property.getKey();
           String propertyValue = property.getValue();
+          String newPropertyName = getNewPropertyName().get(propertyName);
 
           Set<String> newConfigTypes = configHelper.findConfigTypesByPropertyName(cluster.getCurrentStackVersion(),
                   propertyName, cluster.getClusterName());
@@ -1188,7 +1189,7 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
           if(newConfigTypes.size() > 0) {
             newConfigType = newConfigTypes.iterator().next();
           } else {
-            newConfigType = getAdditionalMappingGlobalToEnv().get(propertyName);
+            newConfigType = getAdditionalMappingGlobalToEnv().get(((newPropertyName == null)?
propertyName : newPropertyName));
           }
 
           if(newConfigType==null) {
@@ -1199,13 +1200,13 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
           }
 
           LOG.info("Mapping config " + propertyName + " from " + Configuration.GLOBAL_CONFIG_TAG
+
-              " to " + newConfigType +
+              " to " + ((newPropertyName == null)? propertyName : newPropertyName) + " property
in " + newConfigType +
               " (value="+propertyValue+")");
 
           if(!newProperties.containsKey(newConfigType)) {
             newProperties.put(newConfigType, new HashMap<String, String>());
           }
-          newProperties.get(newConfigType).put(propertyName, propertyValue);
+          newProperties.get(newConfigType).put(((newPropertyName == null)? propertyName :
newPropertyName), propertyValue);
         }
 
         for (Entry<String, Map<String, String>> newProperty : newProperties.entrySet())
{
@@ -1243,10 +1244,17 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
     result.put("storm_keytab","storm-env");
     result.put("hive_hostname","hive-env");
     result.put("oozie_hostname","oozie-env");
+    result.put("dataDir","zoo.cfg");
 
     return result;
   }
 
+  public Map<String, String> getNewPropertyName() {
+    Map<String, String> result = new HashMap<String, String>();
+    result.put("zk_data_dir","dataDir");
+    return result;
+  }
+  
   private void upgradePermissionModel() throws SQLException {
     final UserDAO userDAO = injector.getInstance(UserDAO.class);
     final PrincipalDAO principalDAO = injector.getInstance(PrincipalDAO.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/fad54e32/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
index 42735c0..b51cac2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
@@ -162,7 +162,7 @@ public class UpgradeCatalog170Test {
   }
 
   @Test
-  public void testExecuteDDLUpdates() throws Exception {
+  public void testExecuteDDLUpdates_DBAccessor() throws Exception {
     final DBAccessor dbAccessor = createNiceMock(DBAccessor.class);
     Connection connection = createNiceMock(Connection.class);
     PreparedStatement stmt = createNiceMock(PreparedStatement.class);
@@ -334,9 +334,11 @@ public class UpgradeCatalog170Test {
     Method n = AbstractUpgradeCatalog.class.getDeclaredMethod("getEntityManagerProvider");
     Method l = AbstractUpgradeCatalog.class.getDeclaredMethod
         ("addNewConfigurationsFromXml");
+    Method newPropMap = UpgradeCatalog170.class.getDeclaredMethod("getNewPropertyName");
 
     UpgradeCatalog170 upgradeCatalog = createMockBuilder(UpgradeCatalog170.class)
-      .addMockedMethod(m).addMockedMethod(n).addMockedMethod(l).createMock();
+      .addMockedMethod(m).addMockedMethod(n).addMockedMethod(l).addMockedMethod(newPropMap)
+            .createMock();
 
     List<ConfigGroupConfigMappingEntity> configGroupConfigMappingEntities =
             new ArrayList<ConfigGroupConfigMappingEntity>();
@@ -379,6 +381,7 @@ public class UpgradeCatalog170Test {
     expect(entityManager.createQuery(cq)).andReturn(q).anyTimes();
     expect(trans.isActive()).andReturn(true).anyTimes();
     expect(upgradeCatalog.getEntityManagerProvider()).andReturn(entityManagerProvider).anyTimes();
+    expect(upgradeCatalog.getNewPropertyName()).andReturn(new HashMap<String, String>()).anyTimes();
     expect(cb.createQuery(HostRoleCommandEntity.class)).andReturn(cq).anyTimes();
     expect(cb.desc(taskId)).andReturn(o).anyTimes();
     expect(cq.from(HostRoleCommandEntity.class)).andReturn(hrc).anyTimes();


Mime
View raw message