use of org.apache.accumulo.core.clientImpl.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()) {
context.requireNotDeleted(tableId);
context.requireNotOffline(tableId, tableName);
}
} catch (Exception e) {
mutations.forEach(qcm -> 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.isEmpty())
queueRetry(failures, null);
binnedMutations.forEach(this::queue);
}
use of org.apache.accumulo.core.clientImpl.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);
}
Aggregations