瀏覽代碼

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
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java

+ 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
    * Upgrade Ambari DB schema to the target version passed in as the only
    * argument.
    * argument.
@@ -229,6 +239,8 @@ public class SchemaUpgradeHelper {
 
 
       schemaUpgradeHelper.executeDMLUpdates(upgradeCatalogs);
       schemaUpgradeHelper.executeDMLUpdates(upgradeCatalogs);
 
 
+      schemaUpgradeHelper.resetUIState();
+
       LOG.info("Upgrade successful.");
       LOG.info("Upgrade successful.");
 
 
       schemaUpgradeHelper.stopPersistenceService();
       schemaUpgradeHelper.stopPersistenceService();