Search in sources :

Example 1 with TabletServerMutations

use of org.apache.accumulo.core.client.impl.TabletLocator.TabletServerMutations in project accumulo by apache.

the class TabletLocatorImplTest method runTest.

private void runTest(TabletLocatorImpl metaCache, List<Mutation> ml, Map<String, Map<KeyExtent, List<String>>> emb, String... efailures) throws Exception {
    Map<String, TabletServerMutations<Mutation>> binnedMutations = new HashMap<>();
    List<Mutation> afailures = new ArrayList<>();
    metaCache.binMutations(context, ml, binnedMutations, afailures);
    verify(emb, binnedMutations);
    ArrayList<String> afs = new ArrayList<>();
    ArrayList<String> efs = new ArrayList<>(Arrays.asList(efailures));
    for (Mutation mutation : afailures) {
        afs.add(new String(mutation.getRow()));
    }
    Collections.sort(afs);
    Collections.sort(efs);
    assertEquals(efs, afs);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Mutation(org.apache.accumulo.core.data.Mutation) TabletServerMutations(org.apache.accumulo.core.client.impl.TabletLocator.TabletServerMutations)

Example 2 with TabletServerMutations

use of org.apache.accumulo.core.client.impl.TabletLocator.TabletServerMutations in project accumulo by apache.

the class ConditionalWriterImpl method queue.

private void queue(List<QCMutation> mutations) {
    List<QCMutation> failures = new ArrayList<>();
    Map<String, TabletServerMutations<QCMutation>> binnedMutations = new HashMap<>();
    try {
        locator.binMutations(context, mutations, binnedMutations, failures);
        if (failures.size() == mutations.size())
            if (!Tables.exists(context.getInstance(), tableId))
                throw new TableDeletedException(tableId.canonicalID());
            else if (Tables.getTableState(context.getInstance(), tableId) == TableState.OFFLINE)
                throw new TableOfflineException(context.getInstance(), tableId.canonicalID());
    } catch (Exception e) {
        for (QCMutation qcm : mutations) qcm.queueResult(new Result(e, qcm, null));
        // do not want to queue anything that was put in before binMutations() failed
        failures.clear();
        binnedMutations.clear();
    }
    if (failures.size() > 0)
        queueRetry(failures, null);
    for (Entry<String, TabletServerMutations<QCMutation>> entry : binnedMutations.entrySet()) {
        queue(entry.getKey(), entry.getValue());
    }
}
Also used : TableOfflineException(org.apache.accumulo.core.client.TableOfflineException) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) TableDeletedException(org.apache.accumulo.core.client.TableDeletedException) TableOfflineException(org.apache.accumulo.core.client.TableOfflineException) TTransportException(org.apache.thrift.transport.TTransportException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) NoSuchScanIDException(org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException) VisibilityParseException(org.apache.accumulo.core.security.VisibilityParseException) BadArgumentException(org.apache.accumulo.core.util.BadArgumentException) ThriftSecurityException(org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException) TimedOutException(org.apache.accumulo.core.client.TimedOutException) TableDeletedException(org.apache.accumulo.core.client.TableDeletedException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) NoSuchElementException(java.util.NoSuchElementException) TApplicationException(org.apache.thrift.TApplicationException) TException(org.apache.thrift.TException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) TabletServerMutations(org.apache.accumulo.core.client.impl.TabletLocator.TabletServerMutations) TCMResult(org.apache.accumulo.core.data.thrift.TCMResult)

Aggregations

ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 TabletServerMutations (org.apache.accumulo.core.client.impl.TabletLocator.TabletServerMutations)2 NoSuchElementException (java.util.NoSuchElementException)1 AccumuloException (org.apache.accumulo.core.client.AccumuloException)1 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)1 TableDeletedException (org.apache.accumulo.core.client.TableDeletedException)1 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)1 TableOfflineException (org.apache.accumulo.core.client.TableOfflineException)1 TimedOutException (org.apache.accumulo.core.client.TimedOutException)1 ThriftSecurityException (org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException)1 Mutation (org.apache.accumulo.core.data.Mutation)1 TCMResult (org.apache.accumulo.core.data.thrift.TCMResult)1 VisibilityParseException (org.apache.accumulo.core.security.VisibilityParseException)1 NoSuchScanIDException (org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException)1 BadArgumentException (org.apache.accumulo.core.util.BadArgumentException)1 TApplicationException (org.apache.thrift.TApplicationException)1 TException (org.apache.thrift.TException)1 TTransportException (org.apache.thrift.transport.TTransportException)1