You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2017/08/06 20:31:00 UTC

asterixdb git commit: [ASTERIXDB-2019][CLUS] Sync getting cluster state

Repository: asterixdb
Updated Branches:
  refs/heads/master a14cebbf0 -> 06478601c


[ASTERIXDB-2019][CLUS] Sync getting cluster state

user model changes: no
storage format changes: no
interface changes: no

Details:
- Leave it to the caller when to refresh the cluster state
  after register/deregister of cluster partitions.
- Synchronize cluster state to avoid getting invalid state
  during partitions reg/dereg

Change-Id: I2bc5f86cedeb4728ccbb9811a36a4655a7786246
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1920
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mb...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/06478601
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/06478601
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/06478601

Branch: refs/heads/master
Commit: 06478601cb1cb34363a38f630a0a00e98b782c25
Parents: a14cebb
Author: Murtadha Hubail <mh...@apache.org>
Authored: Sun Aug 6 14:56:29 2017 +0300
Committer: Murtadha Hubail <mh...@apache.org>
Committed: Sun Aug 6 13:30:28 2017 -0700

----------------------------------------------------------------------
 .../asterix/runtime/utils/ClusterStateManager.java       | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/06478601/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
----------------------------------------------------------------------
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 8156a23..ab7d657 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
@@ -225,7 +225,7 @@ public class ClusterStateManager implements IClusterStateManager {
     }
 
     @Override
-    public ClusterState getState() {
+    public synchronized ClusterState getState() {
         return state;
     }
 
@@ -268,7 +268,7 @@ public class ClusterStateManager implements IClusterStateManager {
                 new AlgebricksAbsolutePartitionConstraint(clusterActiveLocations.toArray(new String[] {}));
     }
 
-    public boolean isClusterActive() {
+    public synchronized boolean isClusterActive() {
         if (cluster == null) {
             // this is a virtual cluster
             return true;
@@ -374,12 +374,6 @@ public class ClusterStateManager implements IClusterStateManager {
             clusterPartitions.put(nodePartition.getPartitionId(), nodePartition);
         }
         node2PartitionsMap.put(nodeId, nodePartitions);
-        //TODO fix exception propagation from refreshState
-        try {
-            refreshState();
-        } catch (HyracksDataException e) {
-            throw new AsterixException(e);
-        }
     }
 
     @Override
@@ -394,7 +388,6 @@ public class ClusterStateManager implements IClusterStateManager {
             for (ClusterPartition nodePartition : nodePartitions) {
                 clusterPartitions.remove(nodePartition.getPartitionId());
             }
-            refreshState();
         }
     }