Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 0ea9e971d -> 6d50cd68b


AMBARI-21695. Problem in starting accumulo in upgraded cluster (IOP-HDP). 
(swagle)


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

Branch: refs/heads/branch-2.6
Commit: 8aa5e2c61dbb7eb16243f1ea627d8713d5ff0447
Parents: 2bfc582
Author: Siddharth Wagle <swa...@hortonworks.com>
Authored: Wed Aug 9 15:45:34 2017 -0700
Committer: Siddharth Wagle <swa...@hortonworks.com>
Committed: Wed Aug 9 15:45:46 2017 -0700

----------------------------------------------------------------------
 .../metadata/CachedRoleCommandOrderProvider.java   |  9 ++++++++-
 .../upgrades/FinalizeUpgradeAction.java            | 17 +++++++++++++++++
 .../src/main/resources/scripts/configs.py          |  2 +-
 3 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8aa5e2c6/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
index 49abc66..ec03246 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
@@ -21,6 +21,7 @@ package org.apache.ambari.server.metadata;
 import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.state.Cluster;
@@ -46,7 +47,7 @@ public class CachedRoleCommandOrderProvider implements 
RoleCommandOrderProvider
   @Inject
   private Clusters clusters;
 
-  private Map<Integer, RoleCommandOrder> rcoMap = new HashMap<>();
+  private Map<Integer, RoleCommandOrder> rcoMap = new ConcurrentHashMap<>();
 
   @Inject
   public CachedRoleCommandOrderProvider() {
@@ -124,4 +125,10 @@ public class CachedRoleCommandOrderProvider implements 
RoleCommandOrderProvider
     return rco;
   }
 
+  /**
+   * Clear all entries - used after an upgrade
+   */
+  public void clearRoleCommandOrderCache() {
+    rcoMap.clear();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8aa5e2c6/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
index d531460..b6cdf23 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
@@ -34,6 +34,8 @@ import 
org.apache.ambari.server.agent.ExecutionCommand.KeyNames;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.events.StackUpgradeFinishEvent;
 import org.apache.ambari.server.events.publishers.VersionEventPublisher;
+import org.apache.ambari.server.metadata.CachedRoleCommandOrderProvider;
+import org.apache.ambari.server.metadata.RoleCommandOrderProvider;
 import org.apache.ambari.server.orm.dao.ClusterVersionDAO;
 import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
 import org.apache.ambari.server.orm.dao.HostVersionDAO;
@@ -113,6 +115,9 @@ public class FinalizeUpgradeAction extends 
AbstractServerAction {
   @Inject
   VersionEventPublisher versionEventPublisher;
 
+  @Inject
+  private RoleCommandOrderProvider roleCommandOrderProvider;
+
   /**
    * Used for building {@link UpgradeContext} instances.
    */
@@ -309,6 +314,12 @@ public class FinalizeUpgradeAction extends 
AbstractServerAction {
 
       outSB.append("Upgrade was successful!\n");
 
+      // Clear any cached RCO data after version upgrade
+      if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+        CachedRoleCommandOrderProvider cachedRcoProvider = 
(CachedRoleCommandOrderProvider) roleCommandOrderProvider;
+        cachedRcoProvider.clearRoleCommandOrderCache();
+      }
+
       return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", 
outSB.toString(), errSB.toString());
     } catch (Exception e) {
       errSB.append(e.getMessage());
@@ -442,6 +453,12 @@ public class FinalizeUpgradeAction extends 
AbstractServerAction {
       // Reset upgrade state
       cluster.setUpgradeEntity(null);
 
+      // Clear any cached RCO data after version downgrade
+      if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+        CachedRoleCommandOrderProvider cachedRcoProvider = 
(CachedRoleCommandOrderProvider) roleCommandOrderProvider;
+        cachedRcoProvider.clearRoleCommandOrderCache();
+      }
+
       return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
           out.toString(), err.toString());
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8aa5e2c6/ambari-server/src/main/resources/scripts/configs.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/configs.py 
b/ambari-server/src/main/resources/scripts/configs.py
index 40a8324..639f28e 100644
--- a/ambari-server/src/main/resources/scripts/configs.py
+++ b/ambari-server/src/main/resources/scripts/configs.py
@@ -30,7 +30,7 @@ import xml.etree.ElementTree as ET
 import os
 import logging
 
-logger = logging.getLogger('AmbariTakeoverConfigMerge')
+logger = logging.getLogger('AmbariConfig')
 
 HTTP_PROTOCOL = 'http'
 HTTPS_PROTOCOL = 'https'

Reply via email to