Examples of TServerInstance


Examples of org.apache.accumulo.server.master.state.TServerInstance

  }
 
  private static TServerInstance lookupLastServer(KeyExtent extent, SortedMap<Key,Value> tabletsKeyValues) {
    for (Entry<Key,Value> entry : tabletsKeyValues.entrySet()) {
      if (entry.getKey().getColumnFamily().compareTo(Constants.METADATA_LAST_LOCATION_COLUMN_FAMILY) == 0) {
        return new TServerInstance(entry.getValue(), entry.getKey().getColumnQualifier());
      }
    }
    return null;
  }
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

    if (dfv.getNumEntries() > 0) {
      m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(path), new Value(dfv.encode()));
      Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes(Constants.UTF8)));
      // stuff in this location
      TServerInstance self = getTServerInstance(address, zooLock);
      self.putLastLocation(m);
      // erase the old location
      if (lastLocation != null && !lastLocation.equals(self))
        lastLocation.clearLastLocation(m);
    }
    if (unusedWalLogs != null) {
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

  }

  private static TServerInstance getTServerInstance(String address, ZooLock zooLock) {
    while (true) {
      try {
        return new TServerInstance(address, zooLock.getSessionId());
      } catch (KeeperException e) {
        log.error(e, e);
      } catch (InterruptedException e) {
        log.error(e, e);
      }
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

      m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(path), new Value(size.encode()));

    if (compactionId != null)
      Constants.METADATA_COMPACT_COLUMN.put(m, new Value(Long.toString(compactionId).getBytes(Constants.UTF8)));
   
    TServerInstance self = getTServerInstance(address, zooLock);
    self.putLastLocation(m);
   
    // remove the old location
    if (lastLocation != null && !lastLocation.equals(self))
      lastLocation.clearLastLocation(m);
   
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

        if (dfv.getNumEntries() == 0) {
          fs.delete(newDatafile, true);
        }
      }
     
      TServerInstance lastLocation = null;
      synchronized (Tablet.this) {
       
        t1 = System.currentTimeMillis();
       
        IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

        if (children.size() > 0) {
          Collections.sort(children);
          Stat stat = new Stat();
          byte[] data = rdr.getData(base + "/" + child + "/" + children.get(0), stat);
          if (!"master".equals(new String(data, Constants.UTF8))) {
            result.add(new TServerInstance(AddressUtil.parseAddress(child, Property.TSERV_CLIENTPORT), stat.getEphemeralOwner()));
          }
        }
      } catch (KeeperException.NoNodeException ex) {
        // someone beat us too it
      }
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

   
    List<TServerInstance> currentServers = new ArrayList<TServerInstance>(getTServers(instance));
    Collections.shuffle(currentServers);
    Runtime runtime = Runtime.getRuntime();
    if (currentServers.size() > 1) {
      TServerInstance victim = currentServers.get(0);
      log.info("Stopping " + victim.hostPort());
      Process exec = runtime.exec(new String[] {System.getenv("ACCUMULO_HOME") + "/bin/accumulo", "admin", "stop", victim.hostPort()});
      if (exec.waitFor() != 0)
        throw new RuntimeException("admin stop returned a non-zero response: " + exec.exitValue());
      Set<TServerInstance> set = getTServers(instance);
      if (set.contains(victim))
        throw new RuntimeException("Failed to stop " + victim);
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

                mergeStats = new MergeStats(new MergeInfo());
              }
              mergeStatsCache.put(tableId, mergeStats);
            }
            TabletGoalState goal = getGoalState(tls, mergeStats.getMergeInfo());
            TServerInstance server = tls.getServer();
            TabletState state = tls.getState(currentTServers.keySet());
            stats.update(tableId, state);
            mergeStats.update(tls.extent, state, tls.chopped, !tls.walogs.isEmpty());
            sendChopRequest(mergeStats.getMergeInfo(), state, tls);
            sendSplitRequest(mergeStats.getMergeInfo(), state, tls);
           
            // Always follow through with assignments
            if (state == TabletState.ASSIGNED) {
              goal = TabletGoalState.HOSTED;
            }
           
            // if we are shutting down all the tabletservers, we have to do it in order
            if (goal == TabletGoalState.UNASSIGNED && state == TabletState.HOSTED) {
              if (serversToShutdown.equals(currentTServers.keySet())) {
                if (dependentWatcher != null && dependentWatcher.assignedOrHosted() > 0) {
                  goal = TabletGoalState.HOSTED;
                }
              }
            }
           
            if (goal == TabletGoalState.HOSTED) {
              if (state != TabletState.HOSTED && !tls.walogs.isEmpty()) {
                if (recoveryManager.recoverLogs(tls.extent, tls.walogs))
                  continue;
              }
              switch (state) {
                case HOSTED:
                  if (server.equals(migrations.get(tls.extent)))
                    migrations.remove(tls.extent);
                  break;
                case ASSIGNED_TO_DEAD_SERVER:
                  assignedToDeadServers.add(tls);
                  if (server.equals(migrations.get(tls.extent)))
                    migrations.remove(tls.extent);
                  // log.info("Current servers " + currentTServers.keySet());
                  break;
                case UNASSIGNED:
                  // maybe it's a finishing migration
                  TServerInstance dest = migrations.get(tls.extent);
                  if (dest != null) {
                    // if destination is still good, assign it
                    if (destinations.keySet().contains(dest)) {
                      assignments.add(new Assignment(tls.extent, dest));
                    } else {
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

      }
      Map<Key, Value> all = new HashMap<Key, Value>();
      all.putAll(future);
      all.putAll(assigned);
      for (Entry<Key, Value> entry : all.entrySet()) {
        TServerInstance alive = tserverSet.find(entry.getValue().toString());
        if (alive == null) {
          Master.log.info("Removing entry " + entry);
          BatchWriter bw = getConnector().createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
          Mutation m = new Mutation(entry.getKey().getRow());
          m.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
View Full Code Here

Examples of org.apache.accumulo.server.master.state.TServerInstance

    }

    for (KeyExtent ke : unassigned.keySet())
    {
      int index = r.nextInt(tServerArray.size());
      TServerInstance dest = tServerArray.get(index);
      assignments.put(ke, dest);
      long remaining = toAssign.get(dest).longValue() - 1;
      if (remaining == 0) {
        tServerArray.remove(index);
        toAssign.remove(dest);
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.