Search in sources :

Example 11 with TabletLocationState

use of org.apache.accumulo.core.metadata.TabletLocationState in project accumulo by apache.

the class TabletLocationStateTest method testGetServer_Current.

@Test
public void testGetServer_Current() throws Exception {
    tls = new TabletLocationState(keyExtent, null, current, last, null, walogs, true);
    assertSame(current, tls.getLocation());
}
Also used : TabletLocationState(org.apache.accumulo.core.metadata.TabletLocationState) Test(org.junit.Test)

Example 12 with TabletLocationState

use of org.apache.accumulo.core.metadata.TabletLocationState in project accumulo by apache.

the class TabletLocationStateTest method testGetState_Dead1.

@Test
public void testGetState_Dead1() throws Exception {
    Set<TServerInstance> liveServers = new java.util.HashSet<>();
    liveServers.add(current);
    tls = new TabletLocationState(keyExtent, future, null, last, null, walogs, true);
    assertEquals(TabletState.ASSIGNED_TO_DEAD_SERVER, tls.getState(liveServers));
}
Also used : TabletLocationState(org.apache.accumulo.core.metadata.TabletLocationState) TServerInstance(org.apache.accumulo.core.metadata.TServerInstance) Test(org.junit.Test)

Example 13 with TabletLocationState

use of org.apache.accumulo.core.metadata.TabletLocationState in project accumulo by apache.

the class TabletLocationStateTest method testConstruction_NoFuture.

@Test
public void testConstruction_NoFuture() throws Exception {
    tls = new TabletLocationState(keyExtent, null, current, last, null, walogs, true);
    assertSame(keyExtent, tls.extent);
    assertNull(tls.future);
    assertSame(current, tls.current);
    assertSame(last, tls.last);
    assertSame(walogs, tls.walogs);
    assertTrue(tls.chopped);
}
Also used : TabletLocationState(org.apache.accumulo.core.metadata.TabletLocationState) Test(org.junit.Test)

Example 14 with TabletLocationState

use of org.apache.accumulo.core.metadata.TabletLocationState in project accumulo by apache.

the class CleanUp method isReady.

@Override
public long isReady(long tid, Manager manager) throws Exception {
    if (!manager.hasCycled(creationTime)) {
        return 50;
    }
    boolean done = true;
    Range tableRange = new KeyExtent(tableId, null, null).toMetaRange();
    Scanner scanner = manager.getContext().createScanner(MetadataTable.NAME, Authorizations.EMPTY);
    MetaDataTableScanner.configureScanner(scanner, manager);
    scanner.setRange(tableRange);
    for (Entry<Key, Value> entry : scanner) {
        TabletLocationState locationState = MetaDataTableScanner.createTabletLocationState(entry.getKey(), entry.getValue());
        TabletState state = locationState.getState(manager.onlineTabletServers());
        if (!state.equals(TabletState.UNASSIGNED)) {
            // This code will even wait on tablets that are assigned to dead tablets servers. This is
            // intentional because the manager may make metadata writes for these tablets. See #587
            log.debug("Still waiting for table({}) to be deleted; Target tablet state: UNASSIGNED, " + "Current tablet state: {}, locationState: {}", tableId, state, locationState);
            done = false;
            break;
        }
    }
    if (!done)
        return 50;
    return 0;
}
Also used : BatchScanner(org.apache.accumulo.core.client.BatchScanner) MetaDataTableScanner(org.apache.accumulo.server.manager.state.MetaDataTableScanner) Scanner(org.apache.accumulo.core.client.Scanner) TabletState(org.apache.accumulo.core.metadata.TabletState) Value(org.apache.accumulo.core.data.Value) TabletLocationState(org.apache.accumulo.core.metadata.TabletLocationState) Range(org.apache.accumulo.core.data.Range) KeyExtent(org.apache.accumulo.core.dataImpl.KeyExtent) Key(org.apache.accumulo.core.data.Key)

Example 15 with TabletLocationState

use of org.apache.accumulo.core.metadata.TabletLocationState in project accumulo by apache.

the class MergeStateIT method scan.

private MergeStats scan(MockCurrentState state, TabletStateStore metaDataStateStore) {
    MergeStats stats = new MergeStats(state.mergeInfo);
    stats.getMergeInfo().setState(MergeState.WAITING_FOR_OFFLINE);
    for (TabletLocationState tss : metaDataStateStore) {
        stats.update(tss.extent, tss.getState(state.onlineTabletServers()), tss.chopped, false);
    }
    return stats;
}
Also used : MergeStats(org.apache.accumulo.manager.state.MergeStats) TabletLocationState(org.apache.accumulo.core.metadata.TabletLocationState)

Aggregations

TabletLocationState (org.apache.accumulo.core.metadata.TabletLocationState)35 Test (org.junit.Test)19 TServerInstance (org.apache.accumulo.core.metadata.TServerInstance)15 KeyExtent (org.apache.accumulo.core.dataImpl.KeyExtent)8 TableId (org.apache.accumulo.core.data.TableId)7 Range (org.apache.accumulo.core.data.Range)6 BadLocationStateException (org.apache.accumulo.core.metadata.TabletLocationState.BadLocationStateException)6 Text (org.apache.hadoop.io.Text)6 ArrayList (java.util.ArrayList)5 Value (org.apache.accumulo.core.data.Value)5 MetaDataTableScanner (org.apache.accumulo.server.manager.state.MetaDataTableScanner)5 Key (org.apache.accumulo.core.data.Key)4 Collection (java.util.Collection)3 HashSet (java.util.HashSet)3 AccumuloClient (org.apache.accumulo.core.client.AccumuloClient)3 TabletMutator (org.apache.accumulo.core.metadata.schema.Ample.TabletMutator)3 MergeStats (org.apache.accumulo.manager.state.MergeStats)3 ServerContext (org.apache.accumulo.server.ServerContext)3 Assignment (org.apache.accumulo.server.manager.state.Assignment)3 TabletStateStore (org.apache.accumulo.server.manager.state.TabletStateStore)3