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

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


  public static void main(String[] args) throws Exception {
    ClientOpts opts = new ClientOpts();
    opts.parseArgs(FindOfflineTablets.class.getName(), args);
    final AtomicBoolean scanning = new AtomicBoolean(false);
    Instance instance = opts.getInstance();
    MetaDataTableScanner rootScanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), Constants.METADATA_ROOT_TABLET_KEYSPACE);
    MetaDataTableScanner metaScanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), Constants.NON_ROOT_METADATA_KEYSPACE);
    @SuppressWarnings("unchecked")
    Iterator<TabletLocationState> scanner = (Iterator<TabletLocationState>)new IteratorChain(rootScanner, metaScanner);
    LiveTServerSet tservers = new LiveTServerSet(instance, DefaultConfiguration.getDefaultConfiguration(), new Listener() {
      @Override
      public void update(LiveTServerSet current, Set<TServerInstance> deleted, Set<TServerInstance> added) {
View Full Code Here


    ZooKeeperInstance zki = new ZooKeeperInstance(opts.iname, opts.keepers);
    String tableId = Tables.getTableId(zki, opts.tableName);
   
    // read the locations for the table
    Range tableRange = new KeyExtent(new Text(tableId), null, null).toMetadataRange();
    MetaDataTableScanner s = new MetaDataTableScanner(zki, SecurityConstants.getSystemCredentials(), tableRange);
    long randomSessionID = opts.port;
    TServerInstance instance = new TServerInstance(addr, randomSessionID);
    List<Assignment> assignments = new ArrayList<Assignment>();
    while (s.hasNext()) {
      TabletLocationState next = s.next();
      assignments.add(new Assignment(next.extent, instance));
    }
    s.close();
    // point them to this server
    MetaDataStateStore store = new MetaDataStateStore();
    store.setLocations(assignments);
   
    while (true) {
View Full Code Here

      System.exit(1);
    }
    String instance = args[0];
    String keepers = args[1];
    Instance zooInst = new ZooKeeperInstance(instance, keepers);
    MetaDataTableScanner rootScanner = new MetaDataTableScanner(zooInst, SecurityConstants.getSystemCredentials(),
        Constants.ROOT_TABLET_EXTENT.toMetadataRange());
    MetaDataTableScanner metaScanner = new MetaDataTableScanner(zooInst, SecurityConstants.getSystemCredentials(), Constants.NON_ROOT_METADATA_KEYSPACE);
    @SuppressWarnings("unchecked")
    Iterator<TabletLocationState> scanner = (Iterator<TabletLocationState>) new IteratorChain(rootScanner, metaScanner);
    final AtomicBoolean scanning = new AtomicBoolean(false);
    LiveTServerSet tservers = new LiveTServerSet(zooInst, new Listener() {
      @Override
View Full Code Here

  public static void main(String[] args) throws Exception {
    ClientOpts opts = new ClientOpts();
    opts.parseArgs(FindOfflineTablets.class.getName(), args);
    final AtomicBoolean scanning = new AtomicBoolean(false);
    Instance instance = opts.getInstance();
    MetaDataTableScanner rootScanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), Constants.METADATA_ROOT_TABLET_KEYSPACE);
    MetaDataTableScanner metaScanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), Constants.NON_ROOT_METADATA_KEYSPACE);
    @SuppressWarnings("unchecked")
    Iterator<TabletLocationState> scanner = (Iterator<TabletLocationState>)new IteratorChain(rootScanner, metaScanner);
    LiveTServerSet tservers = new LiveTServerSet(instance, DefaultConfiguration.getDefaultConfiguration(), new Listener() {
      @Override
      public void update(LiveTServerSet current, Set<TServerInstance> deleted, Set<TServerInstance> added) {
View Full Code Here

    ZooKeeperInstance zki = new ZooKeeperInstance(opts.iname, opts.keepers);
    String tableId = Tables.getTableId(zki, opts.tableName);
   
    // read the locations for the table
    Range tableRange = new KeyExtent(new Text(tableId), null, null).toMetadataRange();
    MetaDataTableScanner s = new MetaDataTableScanner(zki, SecurityConstants.getSystemCredentials(), tableRange);
    long randomSessionID = opts.port;
    TServerInstance instance = new TServerInstance(addr, randomSessionID);
    List<Assignment> assignments = new ArrayList<Assignment>();
    while (s.hasNext()) {
      TabletLocationState next = s.next();
      assignments.add(new Assignment(next.extent, instance));
    }
    s.close();
    // point them to this server
    MetaDataStateStore store = new MetaDataStateStore();
    store.setLocations(assignments);
   
    while (true) {
View Full Code Here

  }
 
  private void doTableDetails(HttpServletRequest req, StringBuilder sb, Map<String,String> tidToNameMap, String tableId) {
    String displayName = Tables.getPrintableTableNameFromId(tidToNameMap, tableId);
    Instance instance = HdfsZooInstance.getInstance();
    MetaDataTableScanner scanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), new Range(KeyExtent.getMetadataEntry(new Text(
        tableId), new Text()),
        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);
        }
      }
    }
    scanner.close();
    log.debug("Locs: " + locs);
   
    List<TabletServerStatus> tservers = new ArrayList<TabletServerStatus>();
    if (Monitor.getMmi() != null) {
      for (TabletServerStatus tss : Monitor.getMmi().tServerInfo) {
View Full Code Here

    assertEquals(online.current, online.last);
  }

  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

      // Now the watchers won't assigning tablets for the deleted table
      boolean done = false;
      while (!done) {
        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;
            }
          }
        } finally {
          metaDataTableScanner.close();
        }
        if (!done)
          waitAround();
      }
    }
View Full Code Here

      System.exit(1);
    }
    String instance = args[0];
    String keepers = args[1];
    Instance zooInst = new ZooKeeperInstance(instance, keepers);
    MetaDataTableScanner scanner = new MetaDataTableScanner(zooInst, SecurityConstants.getSystemCredentials(), new Range());
    LiveTServerSet tservers = new LiveTServerSet(zooInst, new Listener() {
      @Override
      public void update(LiveTServerSet current, Set<TServerInstance> deleted, Set<TServerInstance> added) {
        if (!deleted.isEmpty())
          log.warn("Tablet servers deleted while scanning: " + deleted);
        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

  }
 
  private void doTableDetails(HttpServletRequest req, StringBuilder sb, Map<String,String> tidToNameMap, String tableId) {
    String displayName = Tables.getPrintableTableNameFromId(tidToNameMap, tableId);
    Instance instance = HdfsZooInstance.getInstance();
    MetaDataTableScanner scanner = new MetaDataTableScanner(instance, SecurityConstants.getSystemCredentials(), new Range(KeyExtent.getMetadataEntry(new Text(
        tableId), new Text()),
        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);
        }
      }
    }
    scanner.close();
    log.debug("Locs: " + locs);
   
    List<TabletServerStatus> tservers = new ArrayList<TabletServerStatus>();
    if (Monitor.getMmi() != null) {
      for (TabletServerStatus tss : Monitor.getMmi().tServerInfo) {
View Full Code Here

TOP

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

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.