Package com.alibaba.wasp

Examples of com.alibaba.wasp.ServerName


    Map<EntityGroupInfo, Result> offlineSplitParents = FMetaReader
        .getOfflineSplitParents(this.conf);
    // Now work on our list of found parents. See if any we can clean up.
    int fixups = 0;
    for (Map.Entry<EntityGroupInfo, Result> e : offlineSplitParents.entrySet()) {
      ServerName sn = EntityGroupInfo.getServerName(e.getValue());
      if (!serverManager.isServerDead(sn)) { // Otherwise, let SSH take care of
                                             // it
        fixups += ServerShutdownHandler.fixupDaughters(e.getValue(),
            assignmentManager, this.conf);
      }
View Full Code Here


      FServerStartupRequest request) throws ServiceException {
    // Register with server manager
    try {
      InetAddress ia = getRemoteInetAddress(request.getPort(),
          request.getServerStartCode());
      ServerName sn = this.serverManager.fserverStartup(ia, request.getPort(),
          request.getServerStartCode(), request.getServerCurrentTime());

      // Send back some config info
      FServerStartupResponse.Builder resp = createConfigurationSubset();
      StringStringPair.Builder entry = StringStringPair.newBuilder()
          .setName(FConstants.KEY_FOR_HOSTNAME_SEEN_BY_MASTER)
          .setValue(sn.getHostname());
      resp.addMapEntries(entry.build());
      return resp.build();
    } catch (IOException ioe) {
      throw new ServiceException(ioe);
    }
View Full Code Here

  @Override
  public ReportRSFatalErrorResponse reportRSFatalError(
      RpcController controller, ReportRSFatalErrorRequest request)
      throws ServiceException {
    String errorText = request.getErrorMessage();
    ServerName sn = ProtobufUtil.toServerName(request.getServer());
    String msg = "FServer " + sn.toString() + " reported a fatal error:\n"
        + errorText;
    LOG.error(msg);
    return ReportRSFatalErrorResponse.newBuilder().build();
  }
View Full Code Here

      throw new ServiceException(new UnknownEntityGroupException(
          Bytes.toStringBinary(encodedEntityGroupName)));
    }

    EntityGroupInfo egInfo = entityGroupState.getEntityGroup();
    ServerName dest;
    if (destServerName == null || destServerName.length == 0) {
      LOG.info("Passed destination servername is null/empty so "
          + "choosing a server at random");
      final List<ServerName> destServers = this.serverManager
          .createDestinationServersList(entityGroupState.getServerName());
      dest = balancer.randomAssignment(egInfo, destServers);
    } else {
      dest = new ServerName(Bytes.toString(destServerName));
      if (dest.equals(entityGroupState.getServerName())) {
        LOG.debug("Skipping move of entityGroup "
            + egInfo.getEntityGroupNameAsString()
            + " because entityGroup already assigned to the same server "
            + dest + ".");
        return megr;
View Full Code Here

    for (String s : backupMasterStrings) {
      try {
        byte[] bytes = ZKUtil.getData(this.zooKeeper,
            ZKUtil.joinZNode(this.zooKeeper.backupMasterAddressesZNode, s));
        if (bytes != null) {
          ServerName sn;
          try {
            sn = ServerName.parseFrom(bytes);
          } catch (DeserializationException e) {
            LOG.warn("Failed parse, skipping registering backup server", e);
            continue;
View Full Code Here

          return true;
        }
        if (!(Bytes.equals(info.getTableName(), tableNameBytes))) {
          return false;
        }
        ServerName serverName = EntityGroupInfo.getServerName(rowResult);
        // Make sure that entityGroups are assigned to server
        if (!(info.isOffline() || info.isSplit()) && serverName != null
            && serverName.getHostAndPort() != null) {
          actualEgCount.incrementAndGet();
        }
        return true;
      }
    };
View Full Code Here

              return true;
            }
            if (!encodedName.equals(info.getEncodedName())) {
              return true;
            }
            ServerName sn = EntityGroupInfo.getServerName(data);
            result.set(new Pair<EntityGroupInfo, ServerName>(info, sn));
            return false; // found the entityGroup, stop
          }
        };
View Full Code Here

      int cnt = 0;
      int i = incr > 0 ? 0 : underloadedServers.size() - 1;
      for (; i >= 0 && i < underloadedServers.size(); i += incr) {
        if (entityGroupsToMove.isEmpty())
          break;
        ServerName si = sns.get(i);
        int numToTake = underloadedServers.get(si);
        if (numToTake == 0)
          continue;

        addEntityGroupPlan(entityGroupsToMove, fetchFromTail, si, entityGroupsToReturn);
View Full Code Here

    if (numServers > 1) {
      serverIdx = RANDOM.nextInt(numServers);
    }
    int entityGroupIdx = 0;
    for (int j = 0; j < numServers; j++) {
      ServerName server = servers.get((j + serverIdx) % numServers);
      List<EntityGroupInfo> serverEntityGroups = new ArrayList<EntityGroupInfo>(max);
      for (int i = entityGroupIdx; i < numEntityGroups; i += numServers) {
        serverEntityGroups.add(entityGroups.get(i % numEntityGroups));
      }
      assignments.put(server, serverEntityGroups);
View Full Code Here

    int numRandomAssignments = 0;
    int numRetainedAssigments = 0;
    for (Map.Entry<EntityGroupInfo, ServerName> entry : entityGroups.entrySet()) {
      EntityGroupInfo entityGroup = entry.getKey();
      ServerName oldServerName = entry.getValue();
      List<ServerName> localServers = new ArrayList<ServerName>();
      if (oldServerName != null) {
        localServers = serversByHostname.get(oldServerName.getHostname());
      }
      if (localServers.isEmpty()) {
        // No servers on the new cluster match up with this hostname,
        // assign randomly.
        ServerName randomServer = servers.get(RANDOM.nextInt(servers.size()));
        assignments.get(randomServer).add(entityGroup);
        numRandomAssignments++;
        if (oldServerName != null)
          oldHostsNoLongerPresent.add(oldServerName.getHostname());
      } else if (localServers.size() == 1) {
        // the usual case - one new server on same host
        assignments.get(localServers.get(0)).add(entityGroup);
        numRetainedAssigments++;
      } else {
        // multiple new servers in the cluster on this same host
        int size = localServers.size();
        ServerName target = localServers.get(RANDOM.nextInt(size));
        assignments.get(target).add(entityGroup);
        numRetainedAssigments++;
      }
    }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.ServerName

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.