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/655c3c6a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/655c3c6a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/655c3c6a Branch: refs/heads/branch-feature-logsearch-ui Commit: 655c3c6aa1ece4b16e2bc6ae6bcee3061252747d Parents: 3136abe Author: Siddharth Wagle <swa...@hortonworks.com> Authored: Wed Aug 9 20:07:24 2017 -0700 Committer: Siddharth Wagle <swa...@hortonworks.com> Committed: Wed Aug 9 20:07:24 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/655c3c6a/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 53ec23d..f1168a4 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/655c3c6a/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 0a5d301..1ef415a 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/655c3c6a/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 8471d7b..26dcf27 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,7 +35,6 @@ 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; @@ -202,12 +201,6 @@ 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)); @@ -330,12 +323,6 @@ 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());