Examples of MetaDataStateStore


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

    // Read out the TabletLocationStates
    MockCurrentState state = new MockCurrentState(new MergeInfo(new KeyExtent(tableId, new Text("p"), new Text("e")), MergeInfo.Operation.MERGE));
    Credentials credentials = new Credentials("root", new PasswordToken(new byte[0]));

    // Verify the tablet state: hosted, and count
    MetaDataStateStore metaDataStateStore = new MetaDataStateStore(instance, credentials, state);
    int count = 0;
    for (TabletLocationState tss : metaDataStateStore) {
      Assert.assertEquals(TabletState.HOSTED, tss.getState(state.onlineTabletServers()));
      count++;
    }
    Assert.assertEquals(splits.length + 1, count);

    // Create the hole
    // Split the tablet at one end of the range
    Mutation m = new KeyExtent(tableId, new Text("t"), new Text("p")).getPrevRowUpdateMutation();
    TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m, new Value("0.5".getBytes()));
    TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(new Text("o")));
    update(connector, m);

    // do the state check
    MergeStats stats = scan(state, metaDataStateStore);
    MergeState newState = stats.nextMergeState(connector, state);
    Assert.assertEquals(MergeState.WAITING_FOR_OFFLINE, newState);

    // unassign the tablets
    BatchDeleter deleter = connector.createBatchDeleter(MetadataTable.NAME, Authorizations.EMPTY, 1000, new BatchWriterConfig());
    deleter.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
    deleter.setRanges(Collections.singletonList(new Range()));
    deleter.delete();

    // now we should be ready to merge but, we have inconsistent metadata
    stats = scan(state, metaDataStateStore);
    Assert.assertEquals(MergeState.WAITING_FOR_OFFLINE, stats.nextMergeState(connector, state));

    // finish the split
    KeyExtent tablet = new KeyExtent(tableId, new Text("p"), new Text("o"));
    m = tablet.getPrevRowUpdateMutation();
    TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m, new Value("0.5".getBytes()));
    update(connector, m);
    metaDataStateStore.setLocations(Collections.singletonList(new Assignment(tablet, state.someTServer)));

    // onos... there's a new tablet online
    stats = scan(state, metaDataStateStore);
    Assert.assertEquals(MergeState.WAITING_FOR_CHOPPED, stats.nextMergeState(connector, state));

    // chop it
    m = tablet.getPrevRowUpdateMutation();
    ChoppedColumnFamily.CHOPPED_COLUMN.put(m, new Value("junk".getBytes()));
    update(connector, m);

    stats = scan(state, metaDataStateStore);
    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

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

   
    tserverSet.startListeningForTabletServerChanges();
   
    AuthInfo systemAuths = SecurityConstants.getSystemCredentials();
    final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(instance, systemAuths, this),
        new MetaDataStateStore(instance, systemAuths, this)};
    for (int i = 0; i < stores.length; i++) {
      watchers.add(new TabletGroupWatcher(stores[i]));
    }
    for (TabletGroupWatcher watcher : watchers) {
      watcher.start();
View Full Code Here

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

      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) {
      UtilWaitThread.sleep(10000);
    }
  }
View Full Code Here

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

      try {
        zooTabletStateStore = new ZooTabletStateStore();
      } catch (DistributedStoreException e) {
        log.warn("Unable to open ZooTabletStateStore, will retry", e);
      }
      MetaDataStateStore theRest = new MetaDataStateStore();
      for (TabletStateStore store : new TabletStateStore[] {zooTabletStateStore, theRest}) {
        if (store != null) {
          for (TabletLocationState tabletState : store) {
            for (Collection<String> logSet : tabletState.walogs) {
              for (String logEntry : logSet) {
View Full Code Here

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

    while (s.hasNext()) {
      TabletLocationState next = s.next();
      assignments.add(new Assignment(next.extent, instance));
    }
    // point them to this server
    MetaDataStateStore store = new MetaDataStateStore(null);
    store.setLocations(assignments);
   
    while (true) {
      UtilWaitThread.sleep(10000);
    }
  }
View Full Code Here

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

   
    tserverSet.startListeningForTabletServerChanges();
   
    AuthInfo systemAuths = SecurityConstants.getSystemCredentials();
    final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(instance, systemAuths, this),
        new MetaDataStateStore(instance, systemAuths, this)};
    for (int i = 0; i < stores.length; i++) {
      watchers.add(new TabletGroupWatcher(stores[i]));
    }
    for (TabletGroupWatcher watcher : watchers) {
      watcher.start();
View Full Code Here

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

    log.info("Starting with " + count + " tablet servers");
   
    recoverServersToShutdownFromZooKeeper();
    SimpleTimer.getInstance().schedule(new ShutdownTabletServers(), 1000, 1000);
   
    final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(this), new MetaDataStateStore(this)};
    for (int i = 0; i < stores.length; i++) {
      watchers.add(new TabletGroupWatcher(stores[i]));
    }
    for (TabletGroupWatcher watcher : watchers) {
      watcher.start();
View Full Code Here

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

    // Read out the TabletLocationStates
    MockCurrentState state = new MockCurrentState(new MergeInfo(new KeyExtent(tableId, new Text("p"), new Text("e")), MergeInfo.Operation.MERGE));
    AuthInfo auths = new AuthInfo("root", ByteBuffer.wrap("".getBytes()), "instance");
   
    // Verify the tablet state: hosted, and count
    MetaDataStateStore metaDataStateStore = new MetaDataStateStore(instance, auths, state);
    int count = 0;
    for (TabletLocationState tss : metaDataStateStore) {
      Assert.assertEquals(TabletState.HOSTED, tss.getState(state.onlineTabletServers()));
      count++;
    }
    Assert.assertEquals(splits.length + 1, count);
   
    // Create the hole
    // Split the tablet at one end of the range
    Mutation m = new KeyExtent(tableId, new Text("t"), new Text("p")).getPrevRowUpdateMutation();
    ColumnFQ.put(m, Constants.METADATA_SPLIT_RATIO_COLUMN, new Value("0.5".getBytes()));
    ColumnFQ.put(m, Constants.METADATA_OLD_PREV_ROW_COLUMN, KeyExtent.encodePrevEndRow(new Text("o")));
    update(connector, m);
   
    // do the state check
    MergeStats stats = scan(state, metaDataStateStore);
    MergeState newState = stats.nextMergeState(connector, state);
    Assert.assertEquals(MergeState.WAITING_FOR_OFFLINE, newState);
   
    // unassign the tablets
    BatchDeleter deleter = connector.createBatchDeleter("!METADATA", Constants.NO_AUTHS, 1000, 1000l, 1000l, 1);
    deleter.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
    deleter.setRanges(Collections.singletonList(new Range()));
    deleter.delete();
   
    // now we should be ready to merge but, we have an inconsistent !METADATA table
    stats = scan(state, metaDataStateStore);
    Assert.assertEquals(MergeState.WAITING_FOR_OFFLINE, stats.nextMergeState(connector, state));
   
    // finish the split
    KeyExtent tablet = new KeyExtent(tableId, new Text("p"), new Text("o"));
    m = tablet.getPrevRowUpdateMutation();
    ColumnFQ.put(m, Constants.METADATA_SPLIT_RATIO_COLUMN, new Value("0.5".getBytes()));
    update(connector, m);
    metaDataStateStore.setLocations(Collections.singletonList(new Assignment(tablet, state.someTServer)));
   
    // onos... there's a new tablet online
    stats = scan(state, metaDataStateStore);
    Assert.assertEquals(MergeState.WAITING_FOR_CHOPPED, stats.nextMergeState(connector, state));
   
    // chop it
    m = tablet.getPrevRowUpdateMutation();
    ColumnFQ.put(m, Constants.METADATA_CHOPPED_COLUMN, new Value("junk".getBytes()));
    update(connector, m);

    stats = scan(state, metaDataStateStore);
    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
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.