Переглянути джерело

AMBARI-5778. In some upgrade scenarios, Ambari Web's persist key-value store state causes the UI to act unpredictably. (mpapirkovskyy)

Myroslav Papirkovskyy 11 роки тому
батько
коміт
7f24f9c866

+ 12 - 0
ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java

@@ -198,6 +198,16 @@ public class SchemaUpgradeHelper {
     }
   }
 
+  public void resetUIState() throws AmbariException {
+    LOG.info("Resetting UI state.");
+    try {
+      dbAccessor.updateTable("key_value_store", "\"value\"", "{\"clusterState\":\"CLUSTER_STARTED_5\"}",
+          "where \"key\"='CLUSTER_CURRENT_STATUS'");
+    } catch (SQLException e) {
+      throw new AmbariException("Unable to reset UI state", e);
+    }
+  }
+
   /**
    * Upgrade Ambari DB schema to the target version passed in as the only
    * argument.
@@ -229,6 +239,8 @@ public class SchemaUpgradeHelper {
 
       schemaUpgradeHelper.executeDMLUpdates(upgradeCatalogs);
 
+      schemaUpgradeHelper.resetUIState();
+
       LOG.info("Upgrade successful.");
 
       schemaUpgradeHelper.stopPersistenceService();