Murtadha Hubail has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2719

Change subject: [NO ISSUE][REPL] Ignore Replica Request On Non-Active NC Status
......................................................................

[NO ISSUE][REPL] Ignore Replica Request On Non-Active NC Status

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

Details:
- If a node isn't in an ACTIVE status, ignore request to
  add replica since the node hasn't finished bootstrapping.

Change-Id: I3f94bf640987495a8c95bca989e5ac9451a4a7e5
---
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/19/2719/1

diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
index 5c5ce93..a0e3c8b 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
@@ -36,9 +36,11 @@
 import org.apache.asterix.common.transactions.IRecoveryManager;
 import org.apache.asterix.replication.api.PartitionReplica;
 import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
+import org.apache.hyracks.api.client.NodeStatus;
 import org.apache.hyracks.api.config.IApplicationConfig;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.control.common.controllers.NCConfig;
+import org.apache.hyracks.control.nc.NodeControllerService;
 import org.apache.hyracks.storage.common.LocalResource;
 import org.apache.hyracks.util.annotations.ThreadSafe;
 import org.apache.logging.log4j.LogManager;
@@ -74,6 +76,13 @@
             LOGGER.info("ignoring request to add replica to ourselves");
             return;
         }
+        final NodeControllerService controllerService =
+                (NodeControllerService) 
appCtx.getServiceContext().getControllerService();
+        final NodeStatus nodeStatus = controllerService.getNodeStatus();
+        if (nodeStatus != NodeStatus.ACTIVE) {
+            LOGGER.warn("Ignoring request to add replica. Node is not ACTIVE 
yet. Current status: {}", nodeStatus);
+            return;
+        }
         replicas.computeIfAbsent(id, k -> new PartitionReplica(k, appCtx));
         replicas.get(id).sync();
     }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2719
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f94bf640987495a8c95bca989e5ac9451a4a7e5
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <[email protected]>

Reply via email to