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


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

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 5998aa05058d55a3c2f17bafc7ab4f0ab4caab3c
Parents: 8aa5e2c
Author: Siddharth Wagle <swa...@hortonworks.com>
Authored: Wed Aug 9 16:31:54 2017 -0700
Committer: Siddharth Wagle <swa...@hortonworks.com>
Committed: Wed Aug 9 16:31:54 2017 -0700

----------------------------------------------------------------------
 .../listeners/upgrade/StackUpgradeFinishListener.java  | 13 +++++++++++++
 .../metadata/CachedRoleCommandOrderProvider.java       |  1 -
 .../serveraction/upgrades/FinalizeUpgradeAction.java   | 13 -------------
 3 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5998aa05/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
index 1b3d05b..41a0f35 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
@@ -23,6 +23,8 @@ import org.apache.ambari.server.EagerSingleton;
 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.state.Cluster;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
@@ -46,9 +48,13 @@ public class StackUpgradeFinishListener {
    * Logger.
    */
   private final static Logger LOG = 
LoggerFactory.getLogger(StackUpgradeFinishListener.class);
+
   @Inject
   Provider<AmbariMetaInfo> ambariMetaInfo;
 
+  @Inject
+  RoleCommandOrderProvider roleCommandOrderProvider;
+
   /**
    * Constructor.
    *
@@ -80,6 +86,13 @@ public class StackUpgradeFinishListener {
           }
         }
       }
+
+      // Clear the RoleCommandOrder cache on upgrade
+      if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+        LOG.info("Clearing RCO cache");
+        CachedRoleCommandOrderProvider cachedRcoProvider = 
(CachedRoleCommandOrderProvider) roleCommandOrderProvider;
+        cachedRcoProvider.clearRoleCommandOrderCache();
+      }
     }
 
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5998aa05/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 ec03246..4021574 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
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.metadata;
 
-import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;

http://git-wip-us.apache.org/repos/asf/ambari/blob/5998aa05/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 b6cdf23..83e926d 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,7 +34,6 @@ 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;
@@ -314,12 +313,6 @@ 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());
@@ -453,12 +446,6 @@ 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());
 

Reply via email to