Examples of StateTransitionError


Examples of com.linkedin.helix.participant.statemachine.StateTransitionError

              + ", message: " + message);
          _currentStateDelta.setState(partitionKey, _stateModel.getCurrentState());
        }
        else
        {
          StateTransitionError error =
              new StateTransitionError(ErrorType.INTERNAL, ErrorCode.ERROR, exception);
          if (exception instanceof InterruptedException)
          {
            if (_isTimeout)
            {
              error =
                  new StateTransitionError(ErrorType.INTERNAL,
                                           ErrorCode.TIMEOUT,
                                           exception);
            }
            else
            {
              // State transition interrupted but not caused by timeout. Keep the current
              // state in this case
              logger.error("State transition interrupted but not timeout. Not updating state. Partition : "
                  + message.getPartitionName() + " MsgId : " + message.getMsgId());
              return;
            }
          }
          _stateModel.rollbackOnError(message, context, error);
          _currentStateDelta.setState(partitionKey, "ERROR");
          _stateModel.updateState("ERROR");
        }
      }
    }
    try
    {
      // Update the ZK current state of the node
      PropertyKey key = keyBuilder.currentState(instanceName,
                              sessionId,
                              resource,
                              bucketizer.getBucketName(partitionKey));
      if (!_message.getGroupMessageMode())
      {
        accessor.updateProperty(key, _currentStateDelta);
      }
      else
      {
        _executor._groupMsgHandler.addCurStateUpdate(_message, key, _currentStateDelta);
      }
    }
    catch (Exception e)
    {
      logger.error("Error when updating the state ", e);
      StateTransitionError error =
          new StateTransitionError(ErrorType.FRAMEWORK, ErrorCode.ERROR, e);
      _stateModel.rollbackOnError(message, context, error);
      _statusUpdateUtil.logError(message,
                                 HelixStateTransitionHandler.class,
                                 e,
                                 "Error when update the state ",
View Full Code Here

Examples of com.linkedin.helix.participant.statemachine.StateTransitionError

    String instanceName = manager.getInstanceName();
    String partition = _message.getPartitionName();
    String resourceName = _message.getResourceName();
    CurrentState currentStateDelta = new CurrentState(resourceName);

    StateTransitionError error = new StateTransitionError(type, code, e);
    _stateModel.rollbackOnError(_message, _notificationContext, error);
    // if the transition is not canceled, it should go into error state
    if (code == ErrorCode.ERROR)
    {
      currentStateDelta.setState(partition, "ERROR");
View Full Code Here

Examples of com.linkedin.helix.participant.statemachine.StateTransitionError

              + ", message: " + message);
          _currentStateDelta.setState(partitionKey, _stateModel.getCurrentState());
        }
        else
        {
          StateTransitionError error =
              new StateTransitionError(ErrorType.INTERNAL, ErrorCode.ERROR, exception);
          if (exception instanceof InterruptedException)
          {
            if (_isTimeout)
            {
              error =
                  new StateTransitionError(ErrorType.INTERNAL,
                                           ErrorCode.TIMEOUT,
                                           exception);
            }
            else
            {
              // State transition interrupted but not caused by timeout. Keep the current
              // state in this case
              logger.error("State transition interrupted but not timeout. Not updating state. Partition : "
                  + message.getPartitionName() + " MsgId : " + message.getMsgId());
              return;
            }
          }
          _stateModel.rollbackOnError(message, context, error);
          _currentStateDelta.setState(partitionKey, "ERROR");
          _stateModel.updateState("ERROR");
        }
      }
    }
    try
    {
      // Update the ZK current state of the node.
      accessor.updateProperty(keyBuilder.currentState(instanceName,
                                                      sessionId,
                                                      resource,
                                                      bucketizer.getBucketName(partitionKey)),
                              _currentStateDelta);
    }
    catch (Exception e)
    {
      logger.error("Error when updating the state ", e);
      StateTransitionError error =
          new StateTransitionError(ErrorType.FRAMEWORK, ErrorCode.ERROR, e);
      _stateModel.rollbackOnError(message, context, error);
      _statusUpdateUtil.logError(message,
                                 HelixStateTransitionHandler.class,
                                 e,
                                 "Error when update the state ",
View Full Code Here

Examples of com.linkedin.helix.participant.statemachine.StateTransitionError

    String instanceName = manager.getInstanceName();
    String partition = _message.getPartitionName();
    String resourceName = _message.getResourceName();
    CurrentState currentStateDelta = new CurrentState(resourceName);

    StateTransitionError error = new StateTransitionError(type, code, e);
    _stateModel.rollbackOnError(_message, _notificationContext, error);
    // if the transition is not canceled, it should go into error state
    if (code == ErrorCode.ERROR)
    {
      currentStateDelta.setState(partition, "ERROR");
View Full Code Here

Examples of org.apache.helix.participant.statemachine.StateTransitionError

              + ", message: " + message);
          _currentStateDelta.setState(partitionKey, _stateModel.getCurrentState());
        }
        else
        {
          StateTransitionError error =
              new StateTransitionError(ErrorType.INTERNAL, ErrorCode.ERROR, exception);
          if (exception instanceof InterruptedException)
          {
            if (_isTimeout)
            {
              error =
                  new StateTransitionError(ErrorType.INTERNAL,
                                           ErrorCode.TIMEOUT,
                                           exception);
            }
            else
            {
              // State transition interrupted but not caused by timeout. Keep the current
              // state in this case
              logger.error("State transition interrupted but not timeout. Not updating state. Partition : "
                  + message.getPartitionName() + " MsgId : " + message.getMsgId());
              return;
            }
          }
          _stateModel.rollbackOnError(message, context, error);
          _currentStateDelta.setState(partitionKey, "ERROR");
          _stateModel.updateState("ERROR");
        }
      }
    }
    try
    {
      // Update the ZK current state of the node
      PropertyKey key = keyBuilder.currentState(instanceName,
                              sessionId,
                              resource,
                              bucketizer.getBucketName(partitionKey));
      if (!_message.getGroupMessageMode())
      {
        accessor.updateProperty(key, _currentStateDelta);
      }
      else
      {
        _executor._groupMsgHandler.addCurStateUpdate(_message, key, _currentStateDelta);
      }
    }
    catch (Exception e)
    {
      logger.error("Error when updating the state ", e);
      StateTransitionError error =
          new StateTransitionError(ErrorType.FRAMEWORK, ErrorCode.ERROR, e);
      _stateModel.rollbackOnError(message, context, error);
      _statusUpdateUtil.logError(message,
                                 HelixStateTransitionHandler.class,
                                 e,
                                 "Error when update the state ",
View Full Code Here

Examples of org.apache.helix.participant.statemachine.StateTransitionError

    String instanceName = manager.getInstanceName();
    String partition = _message.getPartitionName();
    String resourceName = _message.getResourceName();
    CurrentState currentStateDelta = new CurrentState(resourceName);

    StateTransitionError error = new StateTransitionError(type, code, e);
    _stateModel.rollbackOnError(_message, _notificationContext, error);
    // if the transition is not canceled, it should go into error state
    if (code == ErrorCode.ERROR)
    {
      currentStateDelta.setState(partition, "ERROR");
View Full Code Here

Examples of org.apache.helix.participant.statemachine.StateTransitionError

        logger.warn("Force CurrentState on Zk to be stateModel's CurrentState. partitionKey: "
            + partitionKey + ", currentState: " + _stateModel.getCurrentState() + ", message: "
            + _message);
        _currentStateDelta.setState(partitionKey, _stateModel.getCurrentState());
      } else {
        StateTransitionError error =
            new StateTransitionError(ErrorType.INTERNAL, ErrorCode.ERROR, exception);
        if (exception instanceof InterruptedException) {
          if (_isTimeout) {
            error = new StateTransitionError(ErrorType.INTERNAL, ErrorCode.TIMEOUT, exception);
          } else {
            // State transition interrupted but not caused by timeout. Keep the current
            // state in this case
            logger
                .error("State transition interrupted but not timeout. Not updating state. Partition : "
                    + _message.getPartitionName() + " MsgId : " + _message.getMsgId());
            return;
          }
        }
        _stateModel.rollbackOnError(_message, _notificationContext, error);
        _currentStateDelta.setState(partitionKey, HelixDefinedState.ERROR.toString());
        _stateModel.updateState(HelixDefinedState.ERROR.toString());

        // if we have errors transit from ERROR state, disable the partition
        if (_message.getFromState().equalsIgnoreCase(HelixDefinedState.ERROR.toString())) {
          disablePartition();
        }
      }
    }

    try {
      // Update the ZK current state of the node
      PropertyKey key =
          keyBuilder.currentState(instanceName, sessionId, resource,
              bucketizer.getBucketName(partitionKey));
      if (_message.getAttribute(Attributes.PARENT_MSG_ID) == null) {
        // normal message
        accessor.updateProperty(key, _currentStateDelta);
      } else {
        // sub-message of a batch message
        ConcurrentHashMap<String, CurrentStateUpdate> csUpdateMap =
            (ConcurrentHashMap<String, CurrentStateUpdate>) _notificationContext
                .get(MapKey.CURRENT_STATE_UPDATE.toString());
        csUpdateMap.put(partitionKey, new CurrentStateUpdate(key, _currentStateDelta));
      }
    } catch (Exception e) {
      logger.error("Error when updating current-state ", e);
      StateTransitionError error =
          new StateTransitionError(ErrorType.FRAMEWORK, ErrorCode.ERROR, e);
      _stateModel.rollbackOnError(_message, _notificationContext, error);
      _statusUpdateUtil.logError(_message, HelixStateTransitionHandler.class, e,
          "Error when update current-state ", accessor);
    }
  }
View Full Code Here

Examples of org.apache.helix.participant.statemachine.StateTransitionError

        accessor.updateProperty(
            keyBuilder.currentState(instanceName, _message.getTgtSessionId(), resourceName),
            currentStateDelta);
      }
    } finally {
      StateTransitionError error = new StateTransitionError(type, code, e);
      _stateModel.rollbackOnError(_message, _notificationContext, error);
    }

  }
View Full Code Here

Examples of org.apache.helix.participant.statemachine.StateTransitionError

        _stateModel.setRequestedState(null);
      } catch (Exception e) {
        logger.error(
            "Error when removing " + CurrentState.CurrentStateProperty.REQUESTED_STATE.name()
                + " from current state.", e);
        StateTransitionError error =
            new StateTransitionError(ErrorType.FRAMEWORK, ErrorCode.ERROR, e);
        _stateModel.rollbackOnError(_message, _notificationContext, error);
        _statusUpdateUtil.logError(_message, HelixStateTransitionHandler.class, e,
            "Error when removing " + CurrentState.CurrentStateProperty.REQUESTED_STATE.name()
                + " from current state.", accessor);
      }
View Full Code Here

Examples of org.apache.helix.participant.statemachine.StateTransitionError

        logger.warn("Force CurrentState on Zk to be stateModel's CurrentState. partitionKey: "
            + partitionId + ", currentState: " + _stateModel.getCurrentState() + ", message: "
            + _message);
        _currentStateDelta.setState(partitionId, State.from(_stateModel.getCurrentState()));
      } else {
        StateTransitionError error =
            new StateTransitionError(ErrorType.INTERNAL, ErrorCode.ERROR, exception);
        if (exception instanceof InterruptedException) {
          if (_isTimeout) {
            error = new StateTransitionError(ErrorType.INTERNAL, ErrorCode.TIMEOUT, exception);
          } else {
            // State transition interrupted but not caused by timeout. Keep the current
            // state in this case
            logger
                .error("State transition interrupted but not timeout. Not updating state. Partition : "
                    + _message.getPartitionId() + " MsgId : " + _message.getMessageId());
            return;
          }
        }
        _stateModel.rollbackOnError(_message, _notificationContext, error);
        _currentStateDelta.setState(partitionId, State.from(HelixDefinedState.ERROR.toString()));
        _stateModel.updateState(HelixDefinedState.ERROR.toString());

        // if we have errors transit from ERROR state, disable the partition
        if (_message.getTypedFromState().toString()
            .equalsIgnoreCase(HelixDefinedState.ERROR.toString())) {
          disablePartition();
        }
      }
    }

    try {
      // Update the ZK current state of the node
      PropertyKey key =
          keyBuilder.currentState(instanceName, sessionId.stringify(), resource.stringify(),
              bucketizer.getBucketName(partitionId.stringify()));
      if (_message.getAttribute(Attributes.PARENT_MSG_ID) == null) {
        // normal message
        accessor.updateProperty(key, _currentStateDelta);
      } else {
        // sub-message of a batch message
        ConcurrentHashMap<String, CurrentStateUpdate> csUpdateMap =
            (ConcurrentHashMap<String, CurrentStateUpdate>) _notificationContext
                .get(MapKey.CURRENT_STATE_UPDATE.toString());
        csUpdateMap.put(partitionId.stringify(), new CurrentStateUpdate(key, _currentStateDelta));
      }
    } catch (Exception e) {
      logger.error("Error when updating current-state ", e);
      StateTransitionError error =
          new StateTransitionError(ErrorType.FRAMEWORK, ErrorCode.ERROR, e);
      _stateModel.rollbackOnError(_message, _notificationContext, error);
      _statusUpdateUtil.logError(_message, HelixStateTransitionHandler.class, e,
          "Error when update current-state ", accessor);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.