Repository: ambari Updated Branches: refs/heads/trunk 70c6dbc47 -> afc2f7b24
AMBARI-15161. VERSION_MISMATCH Doesn't Change Back When Component Is Corrected (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/afc2f7b2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/afc2f7b2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/afc2f7b2 Branch: refs/heads/trunk Commit: afc2f7b24f3112466432c9e5dcff07a4fa3931ff Parents: 70c6dbc Author: Lisnichenko Dmitro <dlysniche...@hortonworks.com> Authored: Thu Feb 25 14:01:23 2016 +0200 Committer: Lisnichenko Dmitro <dlysniche...@hortonworks.com> Committed: Thu Feb 25 14:04:52 2016 +0200 ---------------------------------------------------------------------- .../events/listeners/upgrade/StackVersionListener.java | 12 ++++++++++-- .../main/java/org/apache/ambari/server/state/State.java | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/afc2f7b2/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java index e2a7795..9d989f1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListener.java @@ -152,9 +152,11 @@ public class StackVersionListener { private void processComponentVersionChange(Cluster cluster, ServiceComponent sc, ServiceComponentHost sch, String newVersion) { - if (sch.getUpgradeState().equals(UpgradeState.IN_PROGRESS)) { + String desiredVersion = sc.getDesiredVersion(); + UpgradeState upgradeState = sch.getUpgradeState(); + if (upgradeState == UpgradeState.IN_PROGRESS) { // Component status update is received during upgrade process - if (sc.getDesiredVersion().equals(newVersion)) { + if (desiredVersion.equals(newVersion)) { sch.setUpgradeState(UpgradeState.COMPLETE); // Component upgrade confirmed sch.setStackVersion(cluster.getDesiredStackVersion()); } else { // Unexpected (wrong) version received @@ -162,6 +164,12 @@ public class StackVersionListener { // That's why mark as VERSION_MISMATCH sch.setUpgradeState(UpgradeState.VERSION_MISMATCH); } + } else if (upgradeState == UpgradeState.VERSION_MISMATCH && desiredVersion.equals(newVersion)) { + if (cluster.getUpgradeEntity() != null) { + sch.setUpgradeState(UpgradeState.COMPLETE); + } else { + sch.setUpgradeState(UpgradeState.NONE); + } } else { // No upgrade in progress, unexpected version change sch.setUpgradeState(UpgradeState.VERSION_MISMATCH); } http://git-wip-us.apache.org/repos/asf/ambari/blob/afc2f7b2/ambari-server/src/main/java/org/apache/ambari/server/state/State.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/State.java b/ambari-server/src/main/java/org/apache/ambari/server/state/State.java index 78af13f..c3f30c3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/State.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/State.java @@ -62,7 +62,8 @@ public enum State { */ WIPING_OUT, /** - * In the process of upgrading the deployed bits. + * In the process of upgrading the host component deployed bits. + * Valid only for host component state */ UPGRADING, /**