Package org.apache.accumulo.server.master.state

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


  }

  private TabletLocationState getTabletLocationState(Connector c, String tableId) {
    Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
    MetaDataTableScanner s = new MetaDataTableScanner(c.getInstance(), creds, new Range(KeyExtent.getMetadataEntry(new Text(tableId), null)));
    TabletLocationState tlState = s.next();
    s.close();
    return tlState;
  }
View Full Code Here


        stats.begin();
        // Walk through the tablets in our store, and work tablets
        // towards their goal
        iter = store.iterator();
        while (iter.hasNext()) {
          TabletLocationState tls = iter.next();
          if (tls == null) {
            continue;
          }
          // ignore entries for tables that do not exist in zookeeper
          if (TableManager.getInstance().getTableState(tls.extent.getTableId().toString()) == null)
            continue;
         
          if (Master.log.isTraceEnabled())
            Master.log.trace(tls + " walogs " + tls.walogs.size());
                   
          // Don't overwhelm the tablet servers with work
          if (unassigned.size() + unloaded > Master.MAX_TSERVER_WORK_CHUNK * currentTServers.size()) {
            flushChanges(destinations, assignments, assigned, assignedToDeadServers, unassigned);
            assignments.clear();
            assigned.clear();
            assignedToDeadServers.clear();
            unassigned.clear();
            unloaded = 0;
            eventListener.waitForEvents(Master.TIME_TO_WAIT_BETWEEN_SCANS);
          }
          Text tableId = tls.extent.getTableId();
          MergeStats mergeStats = mergeStatsCache.get(tableId);
          if (mergeStats == null) {
            mergeStats = currentMerges.get(tableId);
            if (mergeStats == null) {
              mergeStats = new MergeStats(new MergeInfo());
            }
            mergeStatsCache.put(tableId, mergeStats);
          }
          TabletGoalState goal = this.master.getGoalState(tls, mergeStats.getMergeInfo());
          TServerInstance server = tls.getServer();
          TabletState state = tls.getState(currentTServers.keySet());
          if (Master.log.isTraceEnabled())
            Master.log.trace("Goal state " + goal + " current " + state);
          stats.update(tableId, state);
          mergeStats.update(tls.extent, state, tls.chopped, !tls.walogs.isEmpty());
          sendChopRequest(mergeStats.getMergeInfo(), state, tls);
View Full Code Here

    Assert.assertEquals(MergeState.WAITING_FOR_OFFLINE, stats.nextMergeState(connector, state));

    // take it offline
    m = tablet.getPrevRowUpdateMutation();
    Collection<Collection<String>> walogs = Collections.emptyList();
    metaDataStateStore.unassign(Collections.singletonList(new TabletLocationState(tablet, null, state.someTServer, null, walogs, false)));

    // now we can split
    stats = scan(state, metaDataStateStore);
    Assert.assertEquals(MergeState.MERGING, stats.nextMergeState(connector, state));
View Full Code Here

      recentlyUnloadedCache.put(extent, System.currentTimeMillis());
      onlineTablets.remove(extent);
     
      try {
        TServerInstance instance = new TServerInstance(clientAddress, getLock().getSessionId());
        TabletLocationState tls = new TabletLocationState(extent, null, instance, null, null, false);
        log.debug("Unassigning " + tls);
        TabletStateStore.unassign(tls);
      } catch (DistributedStoreException ex) {
        log.warn("Unable to update storage", ex);
      } catch (KeeperException e) {
View Full Code Here

          ZooTabletStateStore store = new ZooTabletStateStore();
          if (!store.iterator().hasNext()) {
            log.warn("Illegal state: location is not set in zookeeper");
            return null;
          }
          TabletLocationState next = store.iterator().next();
          if (!instance.equals(next.future)) {
            log.warn("Future location is not to this server for the root tablet");
            return null;
          }
          TreeMap<KeyExtent,Text> set = new TreeMap<KeyExtent,Text>();
View Full Code Here

      // stop serving tablet - client will get not serving tablet exceptions
      onlineTablets.remove(extent);
     
      try {
        TServerInstance instance = new TServerInstance(clientAddress, getLock().getSessionId());
        TabletLocationState tls = new TabletLocationState(extent, null, instance, null, null);
        log.debug("Unassigning " + tls);
        TabletStateStore.unassign(tls);
      } catch (DistributedStoreException ex) {
        log.warn("Unable to update storage", ex);
      } catch (KeeperException e) {
View Full Code Here

        done = true;
        Range tableRange = new KeyExtent(new Text(tableId), null, null).toMetadataRange();
        MetaDataTableScanner metaDataTableScanner = new MetaDataTableScanner(tableRange, null, null);
        try {
          while (metaDataTableScanner.hasNext()) {
            TabletLocationState locationState = metaDataTableScanner.next();
            TabletState state = locationState.getState(onlineTabletServers());
            if (state.equals(TabletState.ASSIGNED) || state.equals(TabletState.HOSTED)) {
              log.debug("Still waiting for table to be deleted: " + tableId + " locationState: " + locationState);
              done = false;
              break;
            }
View Full Code Here

        if (!added.isEmpty())
          log.warn("Tablet servers added while scanning: " + added);
      }
    });
    while (scanner.hasNext()) {
      TabletLocationState locationState = scanner.next();
      TabletState state = locationState.getState(tservers.getCurrentServers());
      if (state != TabletState.HOSTED && TableManager.getInstance().getTableState(locationState.extent.getTableId().toString()) != TableState.OFFLINE)
        System.out.println(locationState + " is " + state);
    }
  }
View Full Code Here

        KeyExtent.getMetadataEntry(
        new Text(tableId), null)));
   
    TreeSet<String> locs = new TreeSet<String>();
    while (scanner.hasNext()) {
      TabletLocationState state = scanner.next();
      if (state.current != null) {
        try {
          locs.add(state.current.hostPort());
        } catch (Exception ex) {
          log.error(ex, ex);
View Full Code Here

    MetaDataTableScanner.configureScanner(scanner, environment);
    scanner.setRange(tableRange);
   
    KeyExtent prevExtent = null;
    for (Entry<Key,Value> entry : scanner) {
      TabletLocationState locationState = MetaDataTableScanner.createTabletLocationState(entry.getKey(), entry.getValue());
      if (!locationState.extent.isPreviousExtent(prevExtent)) {
        log.debug("Still waiting for table to be deleted: " + tableId + " saw inconsistency" + prevExtent + " " + locationState.extent);
        done = false;
        break;
      }
      prevExtent = locationState.extent;
     
      TabletState state = locationState.getState(environment.onlineTabletServers());
      if (state.equals(TabletState.ASSIGNED) || state.equals(TabletState.HOSTED)) {
        log.debug("Still waiting for table to be deleted: " + tableId + " locationState: " + locationState);
        done = false;
        break;
      }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.server.master.state.TabletLocationState

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.