[NO ISSUE][ING] Do not process requests when node is not active
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- There is a chance that a node might receive an ActiveManager
request via messaging before the node is active. We should
respond to the CC with a failure indicating that the node
is not active yet to avoid processing a request while the
node is still bootstrapping.
Change-Id: Ibdf0e62902705538c0b00e93f040c13c93d8cb16
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/7943
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Hussain Towaileb <hussainht@gmail.com>
diff --git a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java
index c2227a5..458008b 100644
--- a/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java
+++ b/asterixdb/asterix-active/src/main/java/org/apache/asterix/active/ActiveManager.java
@@ -38,6 +38,7 @@
import org.apache.asterix.common.exceptions.RuntimeDataException;
import org.apache.asterix.common.memory.ConcurrentFramePool;
import org.apache.hyracks.api.application.INCServiceContext;
+import org.apache.hyracks.api.client.NodeStatus;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.util.JavaSerializationUtils;
import org.apache.hyracks.control.nc.NodeControllerService;
@@ -72,6 +73,11 @@
}
public void registerRuntime(IActiveRuntime runtime) throws HyracksDataException {
+ NodeControllerService controllerService = (NodeControllerService) serviceCtx.getControllerService();
+ if (controllerService.getNodeStatus() != NodeStatus.ACTIVE) {
+ throw HyracksDataException.create(org.apache.hyracks.api.exceptions.ErrorCode.NODE_IS_NOT_ACTIVE,
+ serviceCtx.getNodeId());
+ }
if (shutdown) {
throw new RuntimeDataException(ErrorCode.ACTIVE_MANAGER_SHUTDOWN);
}