ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [46/50] [abbrv] ambari git commit: AMBARI-21695. Problem in starting accumulo in upgraded cluster (IOP-HDP). (swagle)
Date Thu, 10 Aug 2017 10:27:52 GMT
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/3136abed
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3136abed
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3136abed

Branch: refs/heads/branch-feature-logsearch-ui
Commit: 3136abed153856c1672e502d71a407abe211828f
Parents: 108ad9b
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Wed Aug 9 15:49:15 2017 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Wed Aug 9 15:49:15 2017 -0700

----------------------------------------------------------------------
 .../metadata/CachedRoleCommandOrderProvider.java   |  9 ++++++++-
 .../upgrades/FinalizeUpgradeAction.java            | 17 +++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3136abed/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 c6315a7..0a5d301 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/3136abed/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 9d70546..8471d7b 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
@@ -35,6 +35,8 @@ import org.apache.ambari.server.agent.CommandReport;
 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.HostComponentStateDAO;
 import org.apache.ambari.server.orm.dao.HostVersionDAO;
 import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
@@ -93,6 +95,9 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
     }
   }
 
+  @Inject
+  private RoleCommandOrderProvider roleCommandOrderProvider;
+
   /**
    * Execution path for upgrade.
    * @return the command report
@@ -197,6 +202,12 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction
{
       // Reset upgrade state
       cluster.setUpgradeEntity(null);
 
+      // Clear any cached RCO data after version upgrade
+      if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+        CachedRoleCommandOrderProvider cachedRcoProvider = (CachedRoleCommandOrderProvider)
roleCommandOrderProvider;
+        cachedRcoProvider.clearRoleCommandOrderCache();
+      }
+
       // the upgrade is done!
       versionEventPublisher.publish(new StackUpgradeFinishEvent(cluster));
 
@@ -319,6 +330,12 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction
{
       // Reset upgrade state
       cluster.setUpgradeEntity(null);
 
+      // Clear any cached RCO data after version upgrade
+      if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+        CachedRoleCommandOrderProvider cachedRcoProvider = (CachedRoleCommandOrderProvider)
roleCommandOrderProvider;
+        cachedRcoProvider.clearRoleCommandOrderCache();
+      }
+
       message = String.format("The downgrade from %s has completed.", downgradeFromVersion);
       outSB.append(message).append(System.lineSeparator());
 


Mime
View raw message