Package org.apache.helix

Examples of org.apache.helix.HelixException


                                             String masterStateValue, String slaveStateValue)
  {
    Collections.sort(instanceNames);
    if(instanceNames.size() < replicas + 1)
    {
      throw new HelixException("Number of instances must not be less than replicas + 1. "
                                      + "instanceNr:" + instanceNames.size()
                                      + ", replicas:" + replicas);
    }
    else if(partitions < instanceNames.size())
    {
View Full Code Here


  {
    Collections.sort(partitions);
    Collections.sort(instances);
    if(instances.size() % replica != 0)
    {
      throw new HelixException("Instances must be divided by replica");
    }
   
    IdealState result = new IdealState(resultRecordName);
    result.setNumPartitions(partitions.size());
    result.setReplicas("" + replica);
View Full Code Here

    int lastPos = colonFormat.lastIndexOf(":");
    if (lastPos <= 0)
    {
      String error = "Invalid storage Instance info format: " + colonFormat;
      LOG.warn(error);
      throw new HelixException(error);
    }
    String host = colonFormat.substring(0, lastPos);
    String portStr = colonFormat.substring(lastPos + 1);
    return host + "_" + portStr;
  }
View Full Code Here

    /**
     * from here on, we are dealing with new session
     */
    if (!ZKUtil.isClusterSetup(_clusterName, _zkclient)) {
      throw new HelixException("Cluster structure is not set up for cluster: " + _clusterName);
    }

    switch (_instanceType) {
    case PARTICIPANT:
      handleNewSessionAsParticipant();
View Full Code Here

      // autoJoin is false
    }

    if (!ZKUtil.isInstanceSetup(_zkclient, _clusterName, _instanceName, _instanceType)) {
      if (!autoJoin) {
        throw new HelixException("Initial cluster structure is not set up for instance: "
            + _instanceName + ", instanceType: " + _instanceType);
      } else {
        LOG.info(_instanceName + " is auto-joining cluster: " + _clusterName);
        InstanceConfig instanceConfig = new InstanceConfig(_instanceName);
        String hostName = _instanceName;
View Full Code Here

      } catch (Exception e) {
        String errorMessage =
            "instance: " + _instanceName + " already has a live-instance in cluster "
                + _clusterName;
        LOG.error(errorMessage);
        throw new HelixException(errorMessage);
      }
    }
  }
View Full Code Here

  String parseFromTarget(String sql) {
    // We need to find out the "FROM" target, and replace it with liveInstances
    // / partitions etc
    int fromIndex = sql.indexOf("FROM");
    if (fromIndex == -1) {
      throw new HelixException("Query must contain FROM target. Query: " + sql);
    }
    // Per JoSql, select FROM <target> the target must be a object class that
    // corresponds to a "table row"
    // In out case, the row is always a ZNRecord

    int nextSpace = sql.indexOf(" ", fromIndex);
    while (sql.charAt(nextSpace) == ' ') {
      nextSpace++;
    }
    int nextnextSpace = sql.indexOf(" ", nextSpace);
    if (nextnextSpace == -1) {
      nextnextSpace = sql.length();
    }
    String fromTarget = sql.substring(nextSpace, nextnextSpace).trim();

    if (fromTarget.length() == 0) {
      throw new HelixException("FROM target in the query cannot be empty. Query: " + sql);
    }
    return fromTarget;
  }
View Full Code Here

    } else if (fromTargetString.equalsIgnoreCase(PropertyType.EXTERNALVIEW.toString() + FLATTABLE)) {
      fromTarget = josqlQuery.getVariable(PropertyType.EXTERNALVIEW.toString() + FLATTABLE);
    } else if (fromTargetString.equalsIgnoreCase(PropertyType.IDEALSTATES.toString() + FLATTABLE)) {
      fromTarget = josqlQuery.getVariable(PropertyType.IDEALSTATES.toString() + FLATTABLE);
    } else {
      throw new HelixException(
          "Unknown query target "
              + fromTargetString
              + ". Target should be PARTITIONS, LIVEINSTANCES, CONFIGS, STATEMODELDEFS, IDEALSTATES, EXTERNALVIEW, and corresponding flat Tables");
    }
View Full Code Here

    return true;
  }

  void checkConnected() {
    if (!isConnected()) {
      throw new HelixException("HelixManager is not connected. Call HelixManager#connect()");
    }
  }
View Full Code Here

        ;
        ClusterSetup setupTool = new ClusterSetup(zkClient);
        setupTool.addResourceToCluster(clusterName, entityName, partitions, stateModelDefRef, mode,
            bucketSize, maxPartitionsPerNode);
      } else {
        throw new HelixException("Unsupported command: " + command + ". Should be one of ["
            + ClusterSetup.addResource + "]");

      }

      getResponse().setEntity(getHostedEntitiesRepresentation(clusterName));
View Full Code Here

TOP

Related Classes of org.apache.helix.HelixException

Copyright © 2018 www.massapicom. 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.