Murtadha Hubail has submitted this change and it was merged. 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 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2719 Sonar-Qube: Jenkins <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Michael Blow <[email protected]> --- M asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java 1 file changed, 9 insertions(+), 0 deletions(-) Approvals: Anon. E. Moose #1000171: Jenkins: Verified; No violations found; ; Verified Michael Blow: Looks good to me, approved Murtadha Hubail: Looks good to me, but someone else must approve 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: merged Gerrit-Change-Id: I3f94bf640987495a8c95bca989e5ac9451a4a7e5 Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
