Minor cleanup, no PENDING on cluster state refresh

Change-Id: I34221471f9aafa4ae970b2f44f80577ebb8bbba7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1803
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
index 64ef5c2..37b3cc2 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
@@ -164,17 +164,18 @@
             }
         }
 
-        setState(ClusterState.PENDING);
-        LOGGER.info("Cluster is now " + state);
-
         // if all storage partitions are active as well as the metadata node, then the cluster is active
         if (metadataNodeActive) {
+            if (state != ClusterState.ACTIVE) {
+                setState(ClusterState.PENDING);
+            }
             appCtx.getMetadataBootstrap().init();
             setState(ClusterState.ACTIVE);
-            LOGGER.info("Cluster is now " + state);
             notifyAll();
             // start global recovery
             appCtx.getGlobalRecoveryManager().startGlobalRecovery(appCtx);
+        } else {
+            setState(ClusterState.PENDING);
         }
     }
 
@@ -377,7 +378,7 @@
     public synchronized void deregisterNodePartitions(String nodeId) {
         ClusterPartition [] nodePartitions = node2PartitionsMap.remove(nodeId);
         if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Deegistering node partitions for node " + nodeId + ": " + Arrays.toString(nodePartitions));
+            LOGGER.info("Deregistering node partitions for node " + nodeId + ": " + Arrays.toString(nodePartitions));
         }
         for (ClusterPartition nodePartition : nodePartitions) {
             clusterPartitions.remove(nodePartition.getPartitionId());