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);
}
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());
}
}
Aggregations