This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 5f5df46fdd616a9f9ee9a2e90fd86b09581e5ab4
Author: Murtadha Hubail <[email protected]>
AuthorDate: Fri Sep 18 13:38:33 2020 +0300

    [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 <[email protected]>
    Tested-by: Jenkins <[email protected]>
    Reviewed-by: Murtadha Hubail <[email protected]>
    Reviewed-by: Hussain Towaileb <[email protected]>
---
 .../src/main/java/org/apache/asterix/active/ActiveManager.java      | 6 ++++++
 1 file changed, 6 insertions(+)

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.ErrorCode;
 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 class ActiveManager {
     }
 
     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);
         }

Reply via email to